plugin-graphql
plugin-graphql copied to clipboard
Not removed data from store when it deleted in API.
Hi! thank you for awesome library!
I found below bug.
When deleted the data in backend, plugin-graphql doesn't remove data from Vuex store on secondary fetch.
Reproduce step
As there is a Item
model(GraphQL)
- In frontend,
Item.fetch({}, true)
- In frontend,
Item.query().all()
. At this time Items count is 5. - In backend, delete one Items randomlly. Items count is 4 in DB.
- In frontend,
Items.fetch({}, true)
. - In frontend,
Items.query().all()
. At this tiem Items count is 5!!. I expect 4 :cold_sweat:
But Vuex-ORM's console log is below. Inserted 4 records.
Vuex-ORM: GraphQL Plugin Inserting Vuex-ORM: GraphQL Plugin Inserting
records (4) [{…}, {…}, {…}, {…}]
In vuex store state, state["entities"].items.data
has 5 records.
This is intended behavior. fetch()
doesn't remove anything from the store.
You have to clear your store before doing a fetch when you want this kind of behavior.
Maybe we could add a option to fetch()
which automatically detects deleted records and removed them from the store :)
I see. I am in favor of this idea.
Maybe we could add a option to fetch() which automatically detects deleted records and removed them from the store :)
status about this? I am also having issues on deleted data. what if other user deleted that data, the data in my browser will use that deleted data and so it will cause data issues