Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: WeakMap when environments are referenced (#3014)
Summary: With this PR I aim to address the situation where environments are removed, but never garbage collected as references are held onto in this Map. A simple case could be: ```js const MyApp = () => { const [environment, setEnvironment] = useState(new Environment({ network, store })); useEffect(() => { setTimeout(() => { setEnvironment(new Environment({ network, store })); }, 1e3); }, []); return (<RelayEnvironmentProvider environment={environment}> <MyComponentTreeWith_A_useFragment/> </RelayEnvironmentProvider>); }; ``` as you'll find from that example, the `dataResources` map will be forever growing, with nothing clearing. fixes: #3013 Pull Request resolved: #3014 Reviewed By: jstejada Differential Revision: D19797050 Pulled By: alunyov fbshipit-source-id: 4ef18e7634c7d50597944967e9ffc0a330ac3633
- Loading branch information
Showing
3 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters