facebook / facebook/relay

[experimental] - useQueryLoader - store update not happening properly

Open
#3,134 4 comments 1 reaction 0 assignees View on GitHub
wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Let's say, I have ViewerQuery and NotesQuery. NotesQuery component is child of ViewerQuery.

**ViewerQuery**

`
query ViewerQuery {
viewer {
id
name
}
}
`

**NotesQuery**

`
query NotesQuery {
viewer {
id
notes {
id
title
body
}
}
}
`

When I run the app, server giving response. In console, it's giving warnings.

- Warning: RelayResponseNormalizer: Payload did not contain a value for field `notes: notes`. Check that you are parsing with the same query that was used to fetch the payload.

- Warning: Relay: Tried reading fragment `NotesQuery` declared in `usePreloadedQuery()`, but it has missing data and its parent query `NotesQuery` is not being fetched.
This might be fixed by by re-running the Relay Compiler. Otherwise, make sure of the following:

* You are correctly fetching `NotesQuery` if you are using a "store-only" `fetchPolicy`.
* Other queries aren't accidentally fetching and overwriting the data for this fragment.
* Any related mutations or subscriptions are fetching all of the data for this fragment.
* Any related store updaters aren't accidentally deleting data for this fragment.

I tried using { fetchPolicy: 'network-only', networkCacheConfig: { force: true } }. But, nothing helps.

**preloadQuery_DEPRECATED** previously it was **preloadQuery**. It was working fine.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.