-
Notifications
You must be signed in to change notification settings - Fork 49.2k
[compiler] Use dependencies from source for useMemo scopes #30179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
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
Summary: This modified the behavior of the compiler when preserving source-level useMemos as reactive scopes to use the depencies from the source as well. This accounts for the possibility that the useMemo in the source is more general than is required by local code, but is necessary due to rules of react violations. With this change, ideally the disableMemoization mode will behave exactly like the uncompiled code. [ghstack-poisoned]
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This was referenced Jul 2, 2024
Comparing: 100dfd7...f9dc5a1 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
Summary: This modified the behavior of the compiler when preserving source-level useMemos as reactive scopes to use the depencies from the source as well. This accounts for the possibility that the useMemo in the source is more general than is required by local code, but is necessary due to rules of react violations. The most complex bit here has to do with explicit dependencies that are globals. As currently written, there's no LoadGlobal that corresponds to a Global dependency of a useMemo, so whenever we convert a useMemo into StartMemoize/FinishMemoize instructions, if we plan to use the useMemo's dependencies we also have to synthesize a LoadGlobal instruction for any globals in the dependencies. With this change, ideally the disableMemoization mode will behave exactly like the uncompiled code. [ghstack-poisoned]
Summary: This modified the behavior of the compiler when preserving source-level useMemos as reactive scopes to use the depencies from the source as well. This accounts for the possibility that the useMemo in the source is more general than is required by local code, but is necessary due to rules of react violations. The most complex bit here has to do with explicit dependencies that are globals. As currently written, there's no LoadGlobal that corresponds to a Global dependency of a useMemo, so whenever we convert a useMemo into StartMemoize/FinishMemoize instructions, if we plan to use the useMemo's dependencies we also have to synthesize a LoadGlobal instruction for any globals in the dependencies. With this change, ideally the disableMemoization mode will behave exactly like the uncompiled code. [ghstack-poisoned]
josephsavona
approved these changes
Jul 11, 2024
Testmasha
pushed a commit
to Testmasha/Test
that referenced
this pull request
Apr 15, 2025
Summary: This modified the behavior of the compiler when preserving source-level useMemos as reactive scopes to use the depencies from the source as well. This accounts for the possibility that the useMemo in the source is more general than is required by local code, but is necessary due to rules of react violations. With this change, ideally the disableMemoization mode will behave exactly like the uncompiled code. ghstack-source-id: 910828c Pull Request resolved: facebook/react#30179
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.
Stack from ghstack (oldest at bottom):
Summary: This modified the behavior of the compiler when preserving source-level useMemos as reactive scopes to use the depencies from the source as well. This accounts for the possibility that the useMemo in the source is more general than is required by local code, but is necessary due to rules of react violations.
The most complex bit here has to do with explicit dependencies that are globals. As currently written, there's no LoadGlobal that corresponds to a Global dependency of a useMemo, so whenever we convert a useMemo into StartMemoize/FinishMemoize instructions, if we plan to use the useMemo's dependencies we also have to synthesize a LoadGlobal instruction for any globals in the dependencies.
With this change, ideally the disableMemoization mode will behave exactly like the uncompiled code.