Invalidation should trigger a call to getParameter to get a fresh context
See original GitHub issueHey,
For some context, I was facing the following bug: https://github.com/n1ru4l/graphql-live-query/issues/980#issuecomment-1340320142
If I’m not mistaken, getParameter is not re-called when re-executing an invalidated query. This is I think the cause of the bug: dataloaders are instantiated when building the contextValue
, so in getParameter
. Thus, subsequent invalidation would make use of old dataloaders, with stale cached data in it. If any resolver depends on dataloaders, invalidation re-execution would use outdated data.
This seems like a major bug / limitation, dataloaders are very much needed in large apps. I’d suggest including the call to getParameter
inside the routine that is launched on invalidation.
Issue Analytics
- State:
- Created 9 months ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to invalidate cache with React query v3? - Stack Overflow
From react-query docs - query invalidation. When a query is invalidated with invalidateQueries , two things happen: It is marked as stale.
Read more >HttpSession (Java(TM) EE 7 Specification APIs)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. An interval value of zero or less...
Read more >Session Management in Java - HttpServlet, Cookies, URL ...
setMaxInactiveInterval(int interval) - Specifies the time, in seconds, between client requests before the servlet container will invalidate this ...
Read more >Java Servlets - A Tutorial
You can use set setMaxInactiveInterval() and getMaxInactiveInterval() to set and get the inactive interval from the last client request, before the server ...
Read more >Session scoped beans and activeViewMaps not cleaned up ...
When running in the context of a request, Mojarra calls FacesContext.getCurrentInstance().getExternalContext.getSessionMap() in order to get/set session ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for your quick response @n1ru4l, I’m glad if my feedback was useful !
If I understand your idea correctly, it would be to pass the initial
contextValue
tocontextFactory
here:https://github.com/n1ru4l/graphql-live-query/blob/9d35033163c31bbead6223bcce7e3450a0876990/packages/in-memory-live-query-store/src/InMemoryLiveQueryStore.ts#L354-L359
Like this:
?
@strblr Yeah, I think the simpler API would be very convenient for library users! Looking forward to your PR!