fix: show previous data while loading new one#121
fix: show previous data while loading new one#121FezVrasta wants to merge 1 commit intotrojanowski:masterfrom
Conversation
50b70fa to
d4b5225
Compare
src/useQuery.ts
Outdated
| ? 'cache-first' | ||
| : actualCachePolicy; | ||
|
|
||
| const lastResult = useRef(); |
There was a problem hiding this comment.
we use this to be able to reference the actual previously returned data, we can't use observableQuery.getLastResult() because observableQuery may get invalidated and return null
d4b5225 to
5e7f47b
Compare
|
I don't know why I'm getting the two type errors reported by CI, the code uses the same |
|
Thanks for submitting, this is broken compared to vanilla apollo React and needs a fix! I suspect the original {}).data code works because it can never return null (so we never get to the right-hand side of the || and there's always .data). I.e. the "|| {}" is never called. It also looks like you need to set a template on your useRef call so the compiler knows that you will be setting null OR the result type. |
|
Closing in favour of #134 |
…hat previous value of `data` is shown while loading new one and `networkStatus` should have a correct value in that case BREAKING CHANGE: previous value of `data` is shown while loading new one Closes trojanowski#117 Closes trojanowski#121 Closes trojanowski#129
This PR should fix the issue reported in #117