Hi, simple CRUD case with apollo client/react - sh...
# prisma-whats-new
m
Hi, simple CRUD case with apollo client/react - show list of records - delete one - return to list, still see deleted record, render() was called with old data - refresh page, deleted removed from list list qery
Copy code
const DishQuery = gql`query allDishes { 
  allDishes(orderBy:updatedAt_DESC) {
    id
    iconid
    translation: dishTranslations(filter:{language:EN}) {
      name
    }
  }
}`;
delete query
Copy code
const DeleteDish = gql`mutation deleteDish($id:ID!) { 
  deleteDish(id: $id) {
    id,
  }
}`;
expected this to be automatic from Apollo without a need to refetch() what I am missing?
n
@mulyoved cheers! You can use
updateQueries
to keep a list uptodate even when creating or deleting nodes.
dataIdFromObject
only makes sure that nodes are uptodate when updating them
👍 1
Are you using react-router?
m
yes
n
And the deletion happens on another route than the list view, right?
m
yes
n
Then you are hitting this bug, even when using `updateQueries`: https://github.com/apollographql/apollo-client/issues/1129
there's already a PR though
m
cool, thanks
n
m
or wiil just refatch and will call the day 🙂
n
🙂