You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ExplorerInjector was originally added to inject the explorer instance into the query client meta field and clear the query cache when the explorer changed. Now that the explorer is pulled from the Jotai store (via getStore(meta) in connector/queries/helpers.ts), the store reference itself never changes — only the explorer atom value inside it does.
The only meaningful side effect ExplorerInjector performs is calling queryClient.clear() when the connection changes. It does this using a "set state during render" pattern to detect when defaultOptions changes, which is indirect and fragile (it already caused an infinite render loop when upgrading babel-plugin-react-compiler to 1.0.0).
We should investigate removing ExplorerInjector entirely and replacing the cache-clearing behavior with a more idiomatic React approach, such as:
Clearing the cache directly in the connection-switching logic (e.g., where the active connection atom is updated)
Using a key prop on a provider to force remounting and get a fresh query client
Relevant Code
packages/graph-explorer/src/core/ExplorerInjector.tsx — the component to remove
ExplorerInjectorwas originally added to inject the explorer instance into the query clientmetafield and clear the query cache when the explorer changed. Now that the explorer is pulled from the Jotai store (viagetStore(meta)inconnector/queries/helpers.ts), the store reference itself never changes — only the explorer atom value inside it does.The only meaningful side effect
ExplorerInjectorperforms is callingqueryClient.clear()when the connection changes. It does this using a "set state during render" pattern to detect whendefaultOptionschanges, which is indirect and fragile (it already caused an infinite render loop when upgradingbabel-plugin-react-compilerto 1.0.0).We should investigate removing
ExplorerInjectorentirely and replacing the cache-clearing behavior with a more idiomatic React approach, such as:keyprop on a provider to force remounting and get a fresh query clientRelevant Code
packages/graph-explorer/src/core/ExplorerInjector.tsx— the component to removepackages/graph-explorer/src/core/ExplorerInjector.test.tsx— associated testspackages/graph-explorer/src/core/queryClient.ts—createDefaultOptionsandcreateQueryClientpackages/graph-explorer/src/connector/queries/helpers.ts—getStore(meta)which reads the store from query metaImportant
If you are interested in working on this issue, please leave a comment.
Tip
Please use a 👍 reaction to provide a +1/vote. This helps the community and maintainers prioritize this request.