We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa723a0 commit de0f9d8Copy full SHA for de0f9d8
examples/offline/src/movies.js
@@ -32,6 +32,9 @@ export const useMovie = (movieId) => {
32
await queryClient.cancelQueries(movieKeys.detail(movieId));
33
const previousData = queryClient.getQueryData(movieKeys.detail(movieId));
34
35
+ // remove local state so that server state is taken instead
36
+ setComment(undefined);
37
+
38
queryClient.setQueryData(movieKeys.detail(movieId), {
39
...previousData,
40
movie: {
@@ -46,8 +49,6 @@ export const useMovie = (movieId) => {
46
49
queryClient.setQueryData(movieKeys.detail(movieId), context.previousData);
47
50
},
48
51
onSettled: () => {
- // remove local state so that server state is taken instead
- setComment(undefined);
52
queryClient.invalidateQueries(movieKeys.detail(movieId));
53
54
});
0 commit comments