I have a project management application built with React and GraphQL for which the Github repo can be found [here](https://github.com/jevoncochran/managr). One of the functionalities allows for deleting a project.

[![enter image description here](https://i.stack.imgur.com/l0Sl2.png)](https://i.stack.imgur.com/l0Sl2.png)

I am trying to update the cache when I delete an individual project.

```
const [deleteProject] = useMutation(DELETE_PROJECT, {
  variables: { id: projectId },
  update(cache, { data: { deleteProject } }) {
    const { projects } = cache.readQuery({ query: GET_PROJECTS });
    cache.writeQuery({
      query: GET_PROJECTS,
      data: {
        projects: projects.filter(
          (project) => project.id !== deleteProject.id
        ),
      },
    });
  },
  onCompleted: () => navigate("/"),
});

```

However, when I attempt to do so, I am getting the following error: `Error: Cannot destructure property 'projects' of 'cache.readQuery(...)' as it is null`

Can someone help me figure out what's going on? This is what the getProjects query looks like:

```
const GET_PROJECTS = gql`
  query getProjects {
    projects {
      id
      name
      description
      status
    }
  }
`;

```

Here is the root query:

```
const RootQuery = new GraphQLObjectType({
  name: "RootQueryType",
  fields: {
    projects: {
      type: new GraphQLList(ProjectType),
      resolve(parent, args) {
        return Project.find();
      },
    },
    project: {
      type: ProjectType,
      args: { id: { type: GraphQLID } },
      resolve(parent, args) {
        return Project.findById(args.id);
      },
    },
    clients: {
      type: new GraphQLList(ClientType),
      resolve(parent, args) {
        return Client.find();
      },
    },
    client: {
      type: ClientType,
      args: { id: { type: GraphQLID } },
      resolve(parent, args) {
        return Client.findById(args.id);
      },
    },
  },
});

```