Replies: 2 comments
-
Probably related to: apollographql/apollo-client#899 |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think it could be related to const omit = function (obj, omitKeys) {
return Object.keys(obj).reduce((result, key) => {
if (!omitKeys.find((omitKey) => { return key === omitKey; })) {
result[key] = obj[key];
}
return result;
}, {});
};
//----
this.$apollo.queries.directory.fetchMore({
variables,
updateQuery: (previousResult, { fetchMoreResult: { getDirById: { assetsPage } } }) => {
const udpatedResult = {
getDirById: omit(previousResult.getDirById, ['assetsPage'])
};
udpatedResult.getDirById.assetsPage = {
totalCount: assetsPage.totalCount,
__typename: 'AssetPage'
};
udpatedResult.getDirById.assetsPage.assets =
[...previousResult.getDirById.assetsPage.assets, ... assetsPage.assets];
return udpatedResult;
}
}); i think overwriting array nested in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm updating query of parent component after removing an item. The problem I'm facing is with updating store: removed item is deleted, but the index in array remains (screenshots below). This causes a lot of problems with rerendering components (Chrome dev-console also attached).
After all deleted component stays rendered.
Code:
Screenshots:
Before removing

16
:After removing

16
:Beta Was this translation helpful? Give feedback.
All reactions