question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalidation should trigger a call to getParameter to get a fresh context

See original GitHub issue

Hey,

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:open
  • Created 9 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
strblrcommented, Dec 7, 2022

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 to contextFactory here:

https://github.com/n1ru4l/graphql-live-query/blob/9d35033163c31bbead6223bcce7e3450a0876990/packages/in-memory-live-query-store/src/InMemoryLiveQueryStore.ts#L354-L359

Like this:

[originalContextSymbol]: await contextFactory(contextValue),

?

0reactions
n1ru4lcommented, Dec 16, 2022

@strblr Yeah, I think the simpler API would be very convenient for library users! Looking forward to your PR!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found