Query not being cleaned up when on Strict Mode
See original GitHub issueIntended outcome:
When unmounting a component that uses useQuery
, it should clean up even when wrapped by Strict Mode.
Actual outcome: Updating the cache on which an unmount component depends, generates a react warning about memory leak.
How to reproduce the issue: https://codesandbox.io/s/nifty-heyrovsky-5cf34 1- Click on “John Smith” and wait for the page to load 2- Click on “Back” 3- Click on “Like” button right by “John Smith” 4- Observe the warning in the console.
Checking on Apollo DevTools, there seems to be more active queries than it should have been after a few times reproducing the issue. Compared to when Strict mode is not active: Versions
@apollo/client: 3.3.15
graphql: 15.4.0
react: 17.0.2
react-dom: 17.0.2
react-router-dom: 5.2.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Having issues with no transact strict mode in mysql - SitePoint
Please am facing issues with NO STRICT TRANS in my database, this is found in the Sql mode settings. And if it is...
Read more >Solved: error "The query parameter 'username' is not suppo...
We have a workflow that does the following: 1- query the user infos of a ... error "The query parameter 'username' is not...
Read more >How to turn on/off MySQL strict mode in localhost (xampp)?
First, check whether the strict mode is enabled or not in mysql using: SHOW VARIABLES ...
Read more >Using strict mode in React 18: A guide to its new behaviors
Strict mode is trying to be future-ready with React's suspense-based architecture, making it more resilient for introspecting UI issues. Let's ...
Read more >MySQL 5.7 Reference Manual :: 5.1.10 Server SQL Modes
ERROR_FOR_DIVISION_BY_ZERO is not part of strict mode, but should be used in ... mysql> SET sql_mode = ''; Query OK, 0 rows affected...
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
This should be fixed with
@apollo/client
>= 3.4 - thanks!While the warning is gone, I still have the issue that the queries are not cleaned up with
@apollo/client
3.4.8 when strict mode is enabled, as shown in this demo: https://codesandbox.io/s/nostalgic-solomon-4stu5Looking at the active queries with the dev tools, it seems like a query is spawned twice, one with “__typename” queried as well and one without. But only the query with “__typename” is cleaned up. Without strict mode, only a query with “__typename” is spawned (and cleaned up).