cssinjs / cssinjs/jss

Global SheetsRegistry leaks memory?

Open
#1,340 0 comments 1 reaction 0 assignees View on GitHub
help wanted perf
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

__Expected behavior:__
Created `StyleSheet` instances should not be retained indefinitely.

__Describe the bug:__
`StyleSheet` instances are being retained inside the global `SheetsRegistry`.

__Codesandbox link:__
Run the `react-jss` example code https://github.com/cssinjs/react-todomvc-jss.git

1. Take memory snapshot.
2. Add a few items.
3. Delete those items.
4. Repeat step 2 and 3 a few more times.
5. Take another memory snapshot.
6. Filter both snapshots by constructor named `StyleSheet` and you'll find the number only grows.

__Versions (please complete the following information):__
- jss: The example is using 6.5.0, but I believe the issue is present in all versions.
- Browser [e.g. chrome, safari]: Chrome
- OS [e.g. Windows, macOS]: MacOS
Feel free to add any additional versions which you may think are relevant to the bug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.