[playground] Fix useEffect on tabify#34594
Merged
EugeneChoi4 merged 4 commits intofacebook:mainfrom Sep 25, 2025
Merged
Conversation
jackpope
requested changes
Sep 25, 2025
| return tabifyCache.get(key)!; | ||
| } | ||
| const result = tabify(store.source, compilerOutput, store.showInternals); | ||
| tabifyCache.set(key, result); |
Contributor
There was a problem hiding this comment.
Since you're using the store as a key this will continue growing forever (potentially on every keystroke) and include the whole store object. This should probably be some form of LRU cache that can clean up the old store keys and promises.
Contributor
Author
There was a problem hiding this comment.
Ah I missed that, thanks for the catch!
jackpope
reviewed
Sep 25, 2025
| export const BASIC_OUTPUT_TAB_NAMES = ['Output', 'SourceMap']; | ||
|
|
||
| const tabifyCache = new LRUCache<Store, Promise<Map<string, ReactNode>>>({ | ||
| max: 100, |
Contributor
There was a problem hiding this comment.
Holding 100 copies of the store still seems like a lot? How many do you really need here?
Contributor
Author
There was a problem hiding this comment.
Right–the cache should not be doing much aside from being used for the use anyways, I'll lower it.
jackpope
approved these changes
Sep 25, 2025
This was referenced Sep 26, 2025
github-actions bot
pushed a commit
to code/lib-react
that referenced
this pull request
Sep 27, 2025
There was a bug in the Compiler Playground related to the "Show Internals" toggle due to a useEffect that was causing the tab names to flicker from a rerender. Rewritten instead with a `<Suspense>` boundary + `use`. DiffTrain build for [250f1b2](facebook@250f1b2)
github-actions bot
pushed a commit
to code/lib-react
that referenced
this pull request
Sep 27, 2025
There was a bug in the Compiler Playground related to the "Show Internals" toggle due to a useEffect that was causing the tab names to flicker from a rerender. Rewritten instead with a `<Suspense>` boundary + `use`. DiffTrain build for [250f1b2](facebook@250f1b2)
EugeneChoi4
added a commit
to EugeneChoi4/react
that referenced
this pull request
Sep 29, 2025
There was a bug in the Compiler Playground related to the "Show Internals" toggle due to a useEffect that was causing the tab names to flicker from a rerender. Rewritten instead with a `<Suspense>` boundary + `use`.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a bug in the Compiler Playground related to the "Show Internals" toggle due to a useEffect that was causing the tab names to flicker from a rerender. Rewritten instead with a
<Suspense>boundary +use.