-
Notifications
You must be signed in to change notification settings - Fork 49k
[Flight] Optimize Retention of Weak Promises Abit #33736
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
Merged
Merged
+43
−23
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
Comparing: a7a1165...8f33f76 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
|
eps1lon
approved these changes
Jul 9, 2025
sebmarkbage
added a commit
that referenced
this pull request
Jul 9, 2025
Follow up to #33736. If we need to save on CPU/memory pressure, we can instead just pray and hope that a Promise doesn't get garbage collected before we need to read it. This can cause fragile access to the Promise value in devtools especially if it's a slow and pressured render. Basically, you'd have to hope that GC doesn't run after the inner await finishes its microtask callback and before the resolution of the component being rendered is invoked.
unstubbable
added a commit
to vercel/next.js
that referenced
this pull request
Jul 10, 2025
When running the following test isolated, and not as part of the full test suite, the owner stacks for async I/O errors were missing the top-most stack frame that's pointing at the `fetch` call. ``` pnpm test-dev test/e2e/app-dir/dynamic-io-errors/dynamic-io-errors.test.ts -t "should show a collapsed redbox with two errors" ``` The same could be reproduced with `pnpm next dev test/e2e/app-dir/dynamic-io-errors/fixtures/default` at http://localhost:3000/dynamic-root, unless http://localhost:3000/static was visited first. The likely reason for that is that React's async I/O tracking was recently optimized for performance reasons in facebook/react#33736 and facebook/react#33737. We can help React a bit with the tracking by explicitly awaiting our `makeHangingPromise` calls. With this fix, the case from above reliably works in isolation.
unstubbable
added a commit
to vercel/next.js
that referenced
this pull request
Jul 10, 2025
When running the following test isolated, and not as part of the full test suite, the owner stacks for async I/O errors were missing the top-most stack frame that's pointing at the `fetch` call. ``` pnpm test-dev test/e2e/app-dir/dynamic-io-errors/dynamic-io-errors.test.ts -t "should show a collapsed redbox with two errors" ``` The same could be reproduced with `pnpm next dev test/e2e/app-dir/dynamic-io-errors/fixtures/default` at http://localhost:3000/dynamic-root, unless http://localhost:3000/static was visited first. The likely reason for that is that React's async I/O tracking was recently optimized for performance reasons in facebook/react#33736 and facebook/react#33737. We can help React a bit with the tracking by explicitly awaiting our `makeHangingPromise` calls. With this fix, the case from above reliably works in isolation.
unstubbable
added a commit
to vercel/next.js
that referenced
this pull request
Jul 14, 2025
When running the following test isolated, and not as part of the full test suite, the owner stacks for async I/O errors were missing the top-most stack frame that's pointing at the `fetch` call. ``` pnpm test-dev test/e2e/app-dir/dynamic-io-errors/dynamic-io-errors.test.ts -t "should show a collapsed redbox with two errors" ``` The same could be reproduced with `pnpm next dev test/e2e/app-dir/dynamic-io-errors/fixtures/default` at http://localhost:3000/dynamic-root, unless http://localhost:3000/static was visited first. The likely reason for that is that React's async I/O tracking was recently optimized for performance reasons in facebook/react#33736 and facebook/react#33737. We can help React a bit with the tracking by explicitly awaiting our `makeHangingPromise` calls. With this fix, the case from above reliably works in isolation.
unstubbable
added a commit
to vercel/next.js
that referenced
this pull request
Jul 15, 2025
When running the following test isolated, and not as part of the full test suite, the owner stacks for async I/O errors were missing the top-most stack frame that's pointing at the `fetch` call. ``` pnpm test-dev test/e2e/app-dir/dynamic-io-errors/dynamic-io-errors.test.ts -t "should show a collapsed redbox with two errors" ``` The same could be reproduced with `pnpm next dev test/e2e/app-dir/dynamic-io-errors/fixtures/default` at http://localhost:3000/dynamic-root, unless http://localhost:3000/static was visited first. The likely reason for that is that React's async I/O tracking was recently optimized for performance reasons in facebook/react#33736 and facebook/react#33737. We can help React a bit with the tracking by explicitly awaiting our `makeHangingPromise` calls. With this fix, the case from above reliably works in isolation.
unstubbable
added a commit
to vercel/next.js
that referenced
this pull request
Jul 15, 2025
When running the following test isolated, and not as part of the full test suite, the owner stacks for async I/O errors were missing the top-most stack frame that's pointing at the `fetch` call. ``` pnpm test-dev test/e2e/app-dir/dynamic-io-errors/dynamic-io-errors.test.ts -t "should show a collapsed redbox with two errors" ``` The same could be reproduced with `pnpm next dev test/e2e/app-dir/dynamic-io-errors/fixtures/default` at http://localhost:3000/dynamic-root, unless http://localhost:3000/static was visited first. The likely reason for that is that React's async I/O tracking was recently optimized for performance reasons in facebook/react#33736 and facebook/react#33737. We can help React a bit with the tracking by explicitly awaiting our `makeHangingPromise` calls. With this fix, the case from above reliably works in isolation.
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.
We don't really need to retain a reference to whatever Promise another Promise was created in. Only awaits need to retain both their trigger and their previous context.