Skip to content

Bugfix: memo drops lower pri updates on bail out - #18091

Merged
acdlite merged 1 commit into
react:masterfrom
acdlite:bugfixmemo
Feb 21, 2020
Merged

Bugfix: memo drops lower pri updates on bail out#18091
acdlite merged 1 commit into
react:masterfrom
acdlite:bugfixmemo

Conversation

@acdlite

Copy link
Copy Markdown
Collaborator

Fixes a bug where lower priority updates on a components wrapped with memo are sometimes left dangling in the queue without ever being processed, if they are preceded by a higher priority bailout.

Cause

The pending update priority field is cleared at the beginning of beginWork. If there is remaining work at a lower priority level, it's expected that it will be accumulated on the work-in-progress fiber during the begin phase.

There's an exception where this assumption doesn't hold: SimpleMemoComponent contains a bailout that occurs before the component is evaluated and the update queues are processed, which means we don't accumulate the next priority level. When we complete the fiber, the work loop is left to believe that there's no remaining work.

Mitigation

Since this only happens in a single case, a late bailout in SimpleMemoComponent, I've mitigated the bug in that code path by restoring the original update priority from the current fiber.

This same case does not apply to MemoComponent, because MemoComponent fibers do not contain hooks or update queues; rather, they wrap around an inner fiber that may contain those. However, I've added a test case for MemoComponent to protect against a possible future regression.

Possible next steps

We should consider moving the update priority assignment in beginWork out of the common path and into each branch, to avoid similar bugs in the future.

Fixes a bug where lower priority updates on a components wrapped with
`memo` are sometimes left dangling in the queue without ever being
processed, if they are preceded by a higher priority bailout.
Cause
-----
The pending update priority field is cleared at the beginning of
`beginWork`. If there is remaining work at a lower priority level, it's
expected that it will be accumulated on the work-in-progress fiber
during the begin phase.
There's an exception where this assumption doesn't hold:
SimpleMemoComponent contains a bailout that occurs *before* the
component is evaluated and the update queues are processed, which means
we don't accumulate the next priority level. When we complete the fiber,
the work loop is left to believe that there's no remaining work.
Mitigation
----------
Since this only happens in a single case, a late bailout in
SimpleMemoComponent, I've mitigated the bug in that code path by
restoring the original update priority from the current fiber.
This same case does not apply to MemoComponent, because MemoComponent
fibers do not contain hooks or update queues; rather, they wrap around
an inner fiber that may contain those. However, I've added a test case
for MemoComponent to protect against a possible future regression.
Possible next steps
-------------------
We should consider moving the update priority assignment in `beginWork`
out of the common path and into each branch, to avoid similar bugs in
the future.
@facebook-github-botfacebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 20, 2020
@sizebot

Copy link
Copy Markdown
Details of bundled changes.

Comparing: ea6ed3d...0da64c2

react-dom

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-dom.profiling.min.js0.0%0.0%123.81 KB123.84 KB38.73 KB38.74 KBNODE_PROFILING
react-dom-unstable-fizz.browser.development.js0.0%+0.1%3.88 KB3.88 KB1.55 KB1.55 KBUMD_DEV
ReactDOM-dev.js+0.1%+0.2%990.7 KB991.96 KB218.38 KB218.85 KBFB_WWW_DEV
react-dom-unstable-fizz.browser.production.min.js0.0%🔺+0.1%1.21 KB1.21 KB708 B709 BUMD_PROD
react-dom-test-utils.development.js0.0%0.0%55.99 KB55.99 KB15.78 KB15.78 KBUMD_DEV
react-dom-testing.profiling.min.js0.0%0.0%121.36 KB121.39 KB38.26 KB38.27 KBNODE_PROFILING
react-dom-server.browser.development.js0.0%0.0%139.77 KB139.77 KB37.1 KB37.11 KBUMD_DEV
react-dom-test-utils.production.min.js0.0%0.0%11.23 KB11.23 KB4.16 KB4.17 KBUMD_PROD
react-dom-test-utils.development.js0.0%0.0%54.26 KB54.26 KB15.47 KB15.47 KBNODE_DEV
react-dom-server.browser.development.js0.0%-0.0%135.71 KB135.71 KB36.09 KB36.09 KBNODE_DEV
react-dom-test-utils.production.min.js0.0%0.0%11 KB11 KB4.11 KB4.11 KBNODE_PROD
react-dom-server.browser.production.min.js0.0%0.0%20.39 KB20.39 KB7.47 KB7.47 KBNODE_PROD
react-dom.development.js+0.1%+0.2%970.41 KB971.67 KB217.97 KB218.45 KBUMD_DEV
react-dom-unstable-native-dependencies.development.js0.0%0.0%58.73 KB58.73 KB15.35 KB15.36 KBUMD_DEV
react-dom.production.min.js0.0%0.0%119.96 KB119.99 KB38.34 KB38.35 KBUMD_PROD
react-dom-unstable-native-dependencies.production.min.js0.0%🔺+0.1%10.25 KB10.25 KB3.47 KB3.47 KBUMD_PROD
ReactDOMServer-dev.js0.0%0.0%140.47 KB140.47 KB35.55 KB35.55 KBFB_WWW_DEV
react-dom.profiling.min.js0.0%0.0%123.59 KB123.63 KB39.51 KB39.52 KBUMD_PROFILING
react-dom.development.js+0.1%+0.2%964.49 KB965.75 KB216.34 KB216.81 KBNODE_DEV
react-dom-unstable-native-dependencies.development.js0.0%0.0%58.43 KB58.43 KB15.28 KB15.28 KBNODE_DEV
react-dom.production.min.js0.0%0.0%120.02 KB120.06 KB37.58 KB37.59 KBNODE_PROD
react-dom-unstable-native-dependencies.production.min.js0.0%🔺+0.1%9.99 KB9.99 KB3.37 KB3.38 KBNODE_PROD
react-dom-unstable-fizz.node.production.min.js0.0%🔺+0.3%1.21 KB1.21 KB695 B697 BNODE_PROD
ReactDOM-prod.js0.0%0.0%373.6 KB373.67 KB67.86 KB67.86 KBFB_WWW_PROD
ReactDOM-profiling.js0.0%0.0%384.9 KB384.97 KB69.92 KB69.93 KBFB_WWW_PROFILING
react-dom-unstable-fizz.browser.development.js0.0%+0.1%3.71 KB3.71 KB1.5 KB1.5 KBNODE_DEV
react-dom-unstable-fizz.browser.production.min.js0.0%🔺+0.3%1.05 KB1.05 KB639 B641 BNODE_PROD
react-dom-testing.development.js+0.1%+0.2%967.25 KB968.51 KB216.81 KB217.28 KBUMD_DEV
react-dom-testing.production.min.js0.0%0.0%117.6 KB117.64 KB37.88 KB37.9 KBUMD_PROD
ReactDOMTesting-dev.js+0.1%+0.2%990.2 KB991.46 KB218.25 KB218.72 KBFB_WWW_DEV
react-dom-testing.profiling.min.js0.0%-0.0%121.13 KB121.16 KB39.02 KB39.01 KBUMD_PROFILING
ReactDOMTesting-prod.js0.0%0.0%371.5 KB371.57 KB67.65 KB67.65 KBFB_WWW_PROD
react-dom-testing.development.js+0.1%+0.2%961.33 KB962.59 KB215.17 KB215.66 KBNODE_DEV
ReactDOMTesting-profiling.js0.0%0.0%371.5 KB371.57 KB67.65 KB67.65 KBFB_WWW_PROFILING
react-dom-server.node.development.js0.0%0.0%136.82 KB136.82 KB36.31 KB36.32 KBNODE_DEV
react-dom-testing.production.min.js0.0%0.0%117.68 KB117.72 KB37.18 KB37.18 KBNODE_PROD
react-dom-server.node.production.min.js0.0%0.0%20.79 KB20.79 KB7.62 KB7.62 KBNODE_PROD

react-art

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
ReactART-dev.js+0.2%+0.4%625.88 KB627.14 KB129.28 KB129.76 KBFB_WWW_DEV
react-art.development.js+0.2%+0.3%682.86 KB684.12 KB146.94 KB147.42 KBUMD_DEV
react-art.production.min.js0.0%-0.0%107.54 KB107.58 KB32.52 KB32.51 KBUMD_PROD
react-art.development.js+0.2%+0.4%613.53 KB614.79 KB129.53 KB130 KBNODE_DEV
react-art.production.min.js0.0%0.0%72.5 KB72.54 KB21.66 KB21.67 KBNODE_PROD
ReactART-prod.js0.0%0.0%233.07 KB233.14 KB39.28 KB39.28 KBFB_WWW_PROD

react-test-renderer

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-test-renderer.development.js+0.2%+0.4%626.65 KB627.91 KB132.13 KB132.59 KBUMD_DEV
react-test-renderer.production.min.js0.0%-0.0%72.16 KB72.19 KB21.96 KB21.95 KBUMD_PROD
react-test-renderer.development.js+0.2%+0.4%621.91 KB623.17 KB130.94 KB131.42 KBNODE_DEV
react-test-renderer.production.min.js0.0%0.0%71.93 KB71.97 KB21.63 KB21.64 KBNODE_PROD
ReactTestRenderer-dev.js+0.2%+0.4%637.38 KB638.63 KB131.78 KB132.25 KBFB_WWW_DEV
react-test-renderer-shallow.development.js0.0%0.0%37.89 KB37.89 KB9.83 KB9.84 KBUMD_DEV
react-test-renderer-shallow.production.min.js0.0%🔺+0.1%11.66 KB11.66 KB3.6 KB3.6 KBUMD_PROD
react-test-renderer-shallow.development.js0.0%0.0%32.43 KB32.43 KB8.53 KB8.53 KBNODE_DEV
react-test-renderer-shallow.production.min.js0.0%0.0%11.79 KB11.79 KB3.71 KB3.71 KBNODE_PROD

react-native-renderer

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
ReactFabric-dev.js+0.2%+0.3%721.91 KB723.17 KB152.6 KB153.08 KBRN_FB_DEV
ReactFabric-prod.js0.0%0.0%260.37 KB260.43 KB44.98 KB44.98 KBRN_FB_PROD
ReactNativeRenderer-dev.js+0.2%+0.3%731.21 KB732.47 KB154.65 KB155.13 KBRN_OSS_DEV
ReactFabric-profiling.js0.0%0.0%271.54 KB271.61 KB47.09 KB47.1 KBRN_FB_PROFILING
ReactNativeRenderer-prod.js0.0%0.0%267.71 KB267.77 KB46.25 KB46.25 KBRN_OSS_PROD
ReactNativeRenderer-profiling.js0.0%0.0%278.93 KB279 KB48.42 KB48.42 KBRN_OSS_PROFILING
ReactNativeRenderer-dev.js+0.2%+0.3%731.38 KB732.64 KB154.74 KB155.21 KBRN_FB_DEV
ReactNativeRenderer-prod.js0.0%0.0%268.1 KB268.16 KB46.31 KB46.31 KBRN_FB_PROD
ReactNativeRenderer-profiling.js0.0%0.0%279.31 KB279.38 KB48.47 KB48.48 KBRN_FB_PROFILING
ReactFabric-dev.js+0.2%+0.3%721.72 KB722.98 KB152.52 KB152.99 KBRN_OSS_DEV
ReactFabric-prod.js0.0%0.0%260.02 KB260.08 KB44.9 KB44.91 KBRN_OSS_PROD
ReactFabric-profiling.js0.0%0.0%271.19 KB271.26 KB47.02 KB47.03 KBRN_OSS_PROFILING

react-reconciler

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-reconciler-persistent.development.js+0.2%+0.4%615.84 KB617.1 KB128.6 KB129.08 KBNODE_DEV
react-reconciler-reflection.development.js0.0%0.0%20.54 KB20.54 KB6.76 KB6.76 KBNODE_DEV
react-reconciler-persistent.production.min.js0.0%0.0%73.76 KB73.8 KB21.79 KB21.79 KBNODE_PROD
react-reconciler-reflection.production.min.js0.0%🔺+0.2%2.86 KB2.86 KB1.24 KB1.24 KBNODE_PROD
react-reconciler.development.js+0.2%+0.4%619.65 KB620.91 KB130.11 KB130.58 KBNODE_DEV
react-reconciler.production.min.js0.0%0.0%76.52 KB76.56 KB22.44 KB22.45 KBNODE_PROD

ReactDOM: size: 0.0%, gzip: 🔺+0.1%

Size changes (experimental)

Generated by 🚫 dangerJS against 0da64c2

@sizebot

Copy link
Copy Markdown
Details of bundled changes.

Comparing: ea6ed3d...0da64c2

react-dom

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
ReactDOM-profiling.js0.0%0.0%408.56 KB408.63 KB74.28 KB74.28 KBFB_WWW_PROFILING
react-dom-testing.production.min.js0.0%0.0%117.15 KB117.19 KB37.04 KB37.05 KBNODE_PROD
react-dom-unstable-native-dependencies.development.js0.0%0.0%58.72 KB58.72 KB15.35 KB15.35 KBUMD_DEV
react-dom-unstable-fizz.browser.production.min.js0.0%🔺+0.3%1.04 KB1.04 KB631 B633 BNODE_PROD
react-dom-testing.profiling.min.js0.0%0.0%120.83 KB120.86 KB38.13 KB38.13 KBNODE_PROFILING
react-dom-unstable-native-dependencies.production.min.js0.0%🔺+0.1%10.24 KB10.24 KB3.46 KB3.47 KBUMD_PROD
react-dom-unstable-fizz.node.development.js0.0%+0.1%4.4 KB4.4 KB1.64 KB1.64 KBNODE_DEV
react-dom.development.js+0.1%+0.2%970.39 KB971.65 KB217.95 KB218.43 KBUMD_DEV
react-dom-unstable-fizz.node.production.min.js0.0%🔺+0.3%1.2 KB1.2 KB687 B689 BNODE_PROD
react-dom.production.min.js0.0%0.0%116.04 KB116.07 KB37.24 KB37.25 KBUMD_PROD
react-dom-server.browser.production.min.js0.0%0.0%20 KB20 KB7.4 KB7.4 KBUMD_PROD
react-dom.profiling.min.js0.0%-0.0%119.56 KB119.6 KB38.4 KB38.39 KBUMD_PROFILING
ReactDOMTesting-dev.js+0.1%+0.2%990.19 KB991.45 KB218.24 KB218.71 KBFB_WWW_DEV
react-dom.development.js+0.1%+0.2%964.47 KB965.73 KB216.32 KB216.8 KBNODE_DEV
ReactDOMTesting-prod.js0.0%0.0%383.81 KB383.87 KB69.73 KB69.74 KBFB_WWW_PROD
react-dom-server.browser.development.js0.0%-0.0%135.68 KB135.68 KB36.08 KB36.08 KBNODE_DEV
react-dom.production.min.js0.0%0.0%116.08 KB116.11 KB36.56 KB36.57 KBNODE_PROD
react-dom-testing.development.js+0.1%+0.2%967.22 KB968.48 KB216.8 KB217.27 KBUMD_DEV
ReactDOMTesting-profiling.js0.0%0.0%383.81 KB383.87 KB69.73 KB69.74 KBFB_WWW_PROFILING
react-dom-server.browser.production.min.js0.0%0.0%19.93 KB19.93 KB7.39 KB7.39 KBNODE_PROD
react-dom-unstable-fizz.browser.development.js0.0%+0.1%3.87 KB3.87 KB1.54 KB1.54 KBUMD_DEV
react-dom.profiling.min.js0.0%0.0%119.75 KB119.78 KB37.66 KB37.66 KBNODE_PROFILING
react-dom-testing.production.min.js0.0%0.0%117.07 KB117.11 KB37.72 KB37.74 KBUMD_PROD
react-dom-unstable-fizz.browser.production.min.js0.0%🔺+0.3%1.2 KB1.2 KB700 B702 BUMD_PROD
ReactDOM-dev.js+0.1%+0.2%991.64 KB992.9 KB218.69 KB219.16 KBFB_WWW_DEV
react-dom-testing.profiling.min.js0.0%-0.0%120.6 KB120.63 KB38.88 KB38.87 KBUMD_PROFILING
ReactDOMServer-dev.js0.0%0.0%140.46 KB140.46 KB35.55 KB35.55 KBFB_WWW_DEV
ReactDOM-prod.js0.0%0.0%397.23 KB397.3 KB72.18 KB72.19 KBFB_WWW_PROD
react-dom-testing.development.js+0.1%+0.2%961.31 KB962.57 KB215.16 KB215.64 KBNODE_DEV
ReactDOMServer-prod.js0.0%-0.0%48.98 KB48.98 KB11.18 KB11.17 KBFB_WWW_PROD
react-dom-unstable-fizz.browser.development.js0.0%+0.1%3.7 KB3.7 KB1.49 KB1.49 KBNODE_DEV
react-dom-unstable-native-dependencies.development.js0.0%0.0%58.42 KB58.42 KB15.27 KB15.28 KBNODE_DEV
react-dom-test-utils.development.js0.0%0.0%55.98 KB55.98 KB15.78 KB15.78 KBUMD_DEV
react-dom-unstable-native-dependencies.production.min.js0.0%🔺+0.1%9.98 KB9.98 KB3.37 KB3.37 KBNODE_PROD
react-dom-test-utils.production.min.js0.0%0.0%11.21 KB11.21 KB4.16 KB4.16 KBUMD_PROD
react-dom-test-utils.development.js0.0%0.0%54.25 KB54.25 KB15.46 KB15.47 KBNODE_DEV
react-dom-server.node.development.js0.0%0.0%136.79 KB136.79 KB36.31 KB36.31 KBNODE_DEV
react-dom-test-utils.production.min.js0.0%0.0%10.99 KB10.99 KB4.1 KB4.1 KBNODE_PROD
react-dom-server.node.production.min.js0.0%0.0%20.34 KB20.34 KB7.54 KB7.54 KBNODE_PROD

react-native-renderer

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
ReactNativeRenderer-prod.js0.0%0.0%267.69 KB267.76 KB46.24 KB46.25 KBRN_OSS_PROD
ReactNativeRenderer-profiling.js0.0%0.0%278.92 KB278.98 KB48.41 KB48.42 KBRN_OSS_PROFILING
ReactFabric-dev.js+0.2%+0.3%721.71 KB722.97 KB152.51 KB152.98 KBRN_OSS_DEV
ReactFabric-prod.js0.0%0.0%260 KB260.07 KB44.89 KB44.9 KBRN_OSS_PROD
ReactFabric-profiling.js0.0%0.0%271.18 KB271.25 KB47.01 KB47.02 KBRN_OSS_PROFILING
ReactNativeRenderer-dev.js+0.2%+0.3%731.2 KB732.46 KB154.65 KB155.12 KBRN_OSS_DEV

react-reconciler

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-reconciler-persistent.development.js+0.2%+0.4%615.83 KB617.09 KB128.59 KB129.07 KBNODE_DEV
react-reconciler-persistent.production.min.js0.0%0.0%73.75 KB73.79 KB21.78 KB21.79 KBNODE_PROD
react-reconciler.development.js+0.2%+0.4%619.64 KB620.9 KB130.11 KB130.58 KBNODE_DEV
react-reconciler-reflection.development.js0.0%0.0%20.52 KB20.52 KB6.76 KB6.76 KBNODE_DEV
react-reconciler.production.min.js0.0%0.0%73.74 KB73.78 KB21.77 KB21.78 KBNODE_PROD
react-reconciler-reflection.production.min.js0.0%🔺+0.2%2.85 KB2.85 KB1.23 KB1.24 KBNODE_PROD

react-art

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-art.production.min.js🔺+0.1%0.0%69.99 KB70.02 KB20.99 KB20.99 KBNODE_PROD
react-art.development.js+0.2%+0.3%682.83 KB684.09 KB146.94 KB147.41 KBUMD_DEV
react-art.production.min.js0.0%-0.0%104.98 KB105.02 KB31.84 KB31.83 KBUMD_PROD
react-art.development.js+0.2%+0.4%613.51 KB614.77 KB129.53 KB130 KBNODE_DEV
ReactART-dev.js+0.2%+0.4%625.87 KB627.13 KB129.28 KB129.75 KBFB_WWW_DEV
ReactART-prod.js0.0%0.0%240.58 KB240.65 KB40.5 KB40.5 KBFB_WWW_PROD

react-test-renderer

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-test-renderer.production.min.js0.0%0.0%71.91 KB71.94 KB21.61 KB21.62 KBNODE_PROD
react-test-renderer-shallow.development.js0.0%0.0%32.42 KB32.42 KB8.52 KB8.52 KBNODE_DEV
react-test-renderer-shallow.production.min.js0.0%🔺+0.1%11.78 KB11.78 KB3.7 KB3.7 KBNODE_PROD
react-test-renderer.development.js+0.2%+0.4%626.62 KB627.88 KB132.11 KB132.58 KBUMD_DEV
react-test-renderer.production.min.js0.0%0.0%72.13 KB72.17 KB21.94 KB21.94 KBUMD_PROD
react-test-renderer.development.js+0.2%+0.4%621.89 KB623.15 KB130.92 KB131.41 KBNODE_DEV
ReactTestRenderer-dev.js+0.2%+0.4%637.36 KB638.62 KB131.78 KB132.25 KBFB_WWW_DEV
react-test-renderer-shallow.development.js0.0%0.0%37.88 KB37.88 KB9.83 KB9.83 KBUMD_DEV
react-test-renderer-shallow.production.min.js0.0%🔺+0.1%11.64 KB11.64 KB3.59 KB3.59 KBUMD_PROD

ReactDOM: size: 0.0%, gzip: 🔺+0.1%

Size changes (stable)

Generated by 🚫 dangerJS against 0da64c2

@dai-shi

Copy link
Copy Markdown
Contributor

Hi, possibly related with #17318 (and #17314 and #17028)?

@acdlite
acdlite merged commit 5de5b61 into react:masterFeb 21, 2020
@acdlite

Copy link
Copy Markdown
CollaboratorAuthor

@dai-shi Yes probably. I'll confirm in a sec.

@gaearongaearon mentioned this pull request Feb 21, 2020
@threepointonethreepointone mentioned this pull request Feb 25, 2020
newkdr added a commit to newkdr/vscode-gitlens that referenced this pull request Dec 12, 2024
![snyk-top-banner](https://redirect.github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)
<h3>Snyk has created this PR to upgrade react-dom from 16.8.4 to
16.14.0.</h3>
:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.
<hr/>
- The recommended version is **13 versions** ahead of your current
version.
- The recommended version was released on **4 years ago**.
<details>
<summary><b>Release notes</b></summary>
<br/>
<details>
<summary>Package name: <b>react-dom</b></summary>
<ul>
<li>
<b>16.14.0</b> - <a
href="https://redirect.github.com/facebook/react/releases/tag/v16.14.0">2020-10-14</a></br><h3>React</h3>
<ul>
<li>Add support for the <a
href="https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html"
rel="nofollow">new JSX transform</a>. (<a
href="https://redirect.github.com/lunaruan">@ lunaruan</a> in <a
href="https://redirect.github.com/facebook/react/pull/18299"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/18299/hovercard">#18299</a>)</li>
</ul>
</li>
<li>
<b>16.13.1</b> - <a
href="https://redirect.github.com/facebook/react/releases/tag/v16.13.1">2020-03-19</a></br><h3>React
DOM</h3>
<ul>
<li>Fix bug in legacy mode Suspense where effect clean-up functions are
not fired. This only affects users who use Suspense for data fetching in
legacy mode, which is not technically supported. (<a
href="https://redirect.github.com/acdlite">@ acdlite</a> in <a
href="https://redirect.github.com/facebook/react/pull/18238"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/18238/hovercard">#18238</a>)</li>
<li>Revert warning for cross-component updates that happen inside class
render lifecycles (<code>componentWillReceiveProps</code>,
<code>shouldComponentUpdate</code>, and so on). (<a
href="https://redirect.github.com/gaearon">@ gaearon</a> in <a
href="https://redirect.github.com/facebook/react/pull/18330"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/18330/hovercard">#18330</a>)</li>
</ul>
<h2>Artifacts</h2>
<ul>
<li>react: <a href="https://unpkg.com/react@16.13.1/umd/"
rel="nofollow">https://unpkg.com/react@16.13.1/umd/</a></li>
<li>react-art: <a href="https://unpkg.com/react-art@16.13.1/umd/"
rel="nofollow">https://unpkg.com/react-art@16.13.1/umd/</a></li>
<li>react-dom: <a href="https://unpkg.com/react-dom@16.13.1/umd/"
rel="nofollow">https://unpkg.com/react-dom@16.13.1/umd/</a></li>
<li>react-is: <a href="https://unpkg.com/react-is@16.13.1/umd/"
rel="nofollow">https://unpkg.com/react-is@16.13.1/umd/</a></li>
<li>react-test-renderer: <a
href="https://unpkg.com/react-test-renderer@16.13.1/umd/"
rel="nofollow">https://unpkg.com/react-test-renderer@16.13.1/umd/</a></li>
<li>scheduler: <a href="https://unpkg.com/scheduler@0.19.1/umd/"
rel="nofollow">https://unpkg.com/scheduler@0.19.1/umd/</a></li>
</ul>
</li>
<li>
<b>16.13.0</b> - <a
href="https://redirect.github.com/facebook/react/releases/tag/v16.13.0">2020-02-26</a></br><h3>React</h3>
<ul>
<li>Warn when a string ref is used in a manner that's not amenable to a
future codemod (<a href="https://redirect.github.com/lunaruan">@
lunaruan</a> in <a
href="https://redirect.github.com/facebook/react/pull/17864"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17864/hovercard">#17864</a>)</li>
<li>Deprecate <code>React.createFactory()</code> (<a
href="https://redirect.github.com/trueadm">@ trueadm</a> in <a
href="https://redirect.github.com/facebook/react/pull/17878"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17878/hovercard">#17878</a>)</li>
</ul>
<h3>React DOM</h3>
<ul>
<li>Warn when changes in <code>style</code> may cause an unexpected
collision (<a href="https://redirect.github.com/sophiebits">@
sophiebits</a> in <a
href="https://redirect.github.com/facebook/react/pull/14181"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/14181/hovercard">#14181</a>, <a
href="https://redirect.github.com/facebook/react/pull/18002"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/18002/hovercard">#18002</a>)</li>
<li>Warn when a function component is updated during another component's
render phase (<a class="user-mention notranslate"
data-hovercard-type="user" data-hovercard-url="/users/acdlite/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/acdlite">@ acdlite</a> in <a
href="https://redirect.github.com/facebook/react/pull/17099"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17099/hovercard">#17099</a>)</li>
<li>Deprecate <code>unstable_createPortal</code> (<a
href="https://redirect.github.com/trueadm">@ trueadm</a> in <a
href="https://redirect.github.com/facebook/react/pull/17880"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17880/hovercard">#17880</a>)</li>
<li>Fix <code>onMouseEnter</code> being fired on disabled buttons (<a
href="https://redirect.github.com/AlfredoGJ">@ AlfredoGJ</a> in <a
href="https://redirect.github.com/facebook/react/pull/17675"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17675/hovercard">#17675</a>)</li>
<li>Call <code>shouldComponentUpdate</code> twice when developing in
<code>StrictMode</code> (<a href="https://redirect.github.com/bvaughn">@
bvaughn</a> in <a
href="https://redirect.github.com/facebook/react/pull/17942"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17942/hovercard">#17942</a>)</li>
<li>Add <code>version</code> property to ReactDOM (<a
href="https://redirect.github.com/ealush">@ ealush</a> in <a
href="https://redirect.github.com/facebook/react/pull/15780"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/15780/hovercard">#15780</a>)</li>
<li>Don't call <code>toString()</code> of
<code>dangerouslySetInnerHTML</code> (<a
href="https://redirect.github.com/sebmarkbage">@ sebmarkbage</a> in <a
href="https://redirect.github.com/facebook/react/pull/17773"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17773/hovercard">#17773</a>)</li>
<li>Show component stacks in more warnings (<a
href="https://redirect.github.com/gaearon">@ gaearon</a> in <a
href="https://redirect.github.com/facebook/react/pull/17922"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17922/hovercard">#17922</a>, <a
href="https://redirect.github.com/facebook/react/pull/17586"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17586/hovercard">#17586</a>)</li>
</ul>
<h3>Concurrent Mode (Experimental)</h3>
<ul>
<li>Warn for problematic usages of <code>ReactDOM.createRoot()</code>
(<a href="https://redirect.github.com/trueadm">@ trueadm</a> in <a
href="https://redirect.github.com/facebook/react/pull/17937"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17937/hovercard">#17937</a>)</li>
<li>Remove <code>ReactDOM.createRoot()</code> callback params and added
warnings on usage (<a href="https://redirect.github.com/bvaughn">@
bvaughn</a> in <a
href="https://redirect.github.com/facebook/react/pull/17916"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17916/hovercard">#17916</a>)</li>
<li>Don't group Idle/Offscreen work with other work (<a
href="https://redirect.github.com/sebmarkbage">@ sebmarkbage</a> in <a
href="https://redirect.github.com/facebook/react/pull/17456"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17456/hovercard">#17456</a>)</li>
<li>Adjust <code>SuspenseList</code> CPU bound heuristic (<a
href="https://redirect.github.com/sebmarkbage">@ sebmarkbage</a> in <a
href="https://redirect.github.com/facebook/react/pull/17455"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17455/hovercard">#17455</a>)</li>
<li>Add missing event plugin priorities (<a
href="https://redirect.github.com/trueadm">@ trueadm</a> in <a
href="https://redirect.github.com/facebook/react/pull/17914"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17914/hovercard">#17914</a>)</li>
<li>Fix <code>isPending</code> only being true when transitioning from
inside an input event (<a href="https://redirect.github.com/acdlite">@
acdlite</a> in <a
href="https://redirect.github.com/facebook/react/pull/17382"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17382/hovercard">#17382</a>)</li>
<li>Fix <code>React.memo</code> components dropping updates when
interrupted by a higher priority update (<a class="user-mention
notranslate" data-hovercard-type="user"
data-hovercard-url="/users/acdlite/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/acdlite">@ acdlite</a> in <a
href="https://redirect.github.com/facebook/react/pull/18091"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/18091/hovercard">#18091</a>)</li>
<li>Don't warn when suspending at the wrong priority (<a
href="https://redirect.github.com/gaearon">@ gaearon</a> in <a
href="https://redirect.github.com/facebook/react/pull/17971"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17971/hovercard">#17971</a>)</li>
<li>Fix a bug with rebasing updates (<a
href="https://redirect.github.com/acdlite">@ acdlite</a> and <a
href="https://redirect.github.com/sebmarkbage">@ sebmarkbage</a> in <a
href="https://redirect.github.com/facebook/react/pull/17560"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17560/hovercard">#17560</a>, <a
href="https://redirect.github.com/facebook/react/pull/17510"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17510/hovercard">#17510</a>, <a
href="https://redirect.github.com/facebook/react/pull/17483"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17483/hovercard">#17483</a>, <a
href="https://redirect.github.com/facebook/react/pull/17480"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17480/hovercard">#17480</a>)</li>
</ul>
<h2>Artifacts</h2>
<ul>
<li>react: <a href="https://unpkg.com/react@16.13.0/umd/"
rel="nofollow">https://unpkg.com/react@16.13.0/umd/</a></li>
<li>react-art: <a href="https://unpkg.com/react-art@16.13.0/umd/"
rel="nofollow">https://unpkg.com/react-art@16.13.0/umd/</a></li>
<li>react-dom: <a href="https://unpkg.com/react-dom@16.13.0/umd/"
rel="nofollow">https://unpkg.com/react-dom@16.13.0/umd/</a></li>
<li>react-is: <a href="https://unpkg.com/react-is@16.13.0/umd/"
rel="nofollow">https://unpkg.com/react-is@16.13.0/umd/</a></li>
<li>react-test-renderer: <a
href="https://unpkg.com/react-test-renderer@16.13.0/umd/"
rel="nofollow">https://unpkg.com/react-test-renderer@16.13.0/umd/</a></li>
<li>scheduler: <a href="https://unpkg.com/scheduler@0.19.0/umd/"
rel="nofollow">https://unpkg.com/scheduler@0.19.0/umd/</a></li>
</ul>
</li>
<li>
<b>16.12.0</b> - <a
href="https://redirect.github.com/facebook/react/releases/tag/v16.12.0">2019-11-14</a></br><h3>React
DOM</h3>
<ul>
<li>Fix passive effects (<code>useEffect</code>) not being fired in a
multi-root app. (<a href="https://redirect.github.com/acdlite">@
acdlite</a> in <a
href="https://redirect.github.com/facebook/react/pull/17347"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17347/hovercard">#17347</a>)</li>
</ul>
<h3>React Is</h3>
<ul>
<li>Fix <code>lazy</code> and <code>memo</code> types considered
elements instead of components (<a
href="https://redirect.github.com/bvaughn">@ bvaughn</a> in <a
href="https://redirect.github.com/facebook/react/pull/17278"
data-hovercard-type="pull_request"
data-hovercard-url="/react/react/pull/17278/hovercard">#17278</a>)</li>
</ul>
<h2>Artifacts</h2>
<p>• react: <a href="https://unpkg.com/react@16.12.0/umd/"
rel="nofollow">https://unpkg.com/react@16.12.0/umd/</a><br>
• react-art: <a href="https://unpkg.com/react-art@16.12.0/umd/"
rel="nofollow">https://unpkg.com/react-art@16.12.0/umd/</a><br>
• react-dom: <a href="https://unpkg.com/react-dom@16.12.0/umd/"
rel="nofollow">https://unpkg.com/react-dom@16.12.0/umd/</a><br>
• react-is: <a href="https://unpkg.com/react-is@16.12.0/umd/"
rel="nofollow">https://unpkg.com/react-is@16.12.0/umd/</a><br>
• react-test-renderer: <a
href="https://unpkg.com/react-test-renderer@16.12.0/umd/"
rel="nofollow">https://unpkg.com/react-test-renderer@16.12.0/umd/</a><br>
• scheduler: <a href="https://unpkg.com/scheduler@0.18.0/umd/"
rel="nofollow">https://unpkg.com/scheduler@0.18.0/umd/</a></p>
</li>
<li>
<b>16.11.0</b> - 2019-10-22
</li>
<li>
<b>16.10.2</b> - 2019-10-03
</li>
<li>
<b>16.10.1</b> - 2019-09-28
</li>
<li>
<b>16.10.0</b> - 2019-09-27
</li>
<li>
<b>16.9.0</b> - 2019-08-08
</li>
<li>
<b>16.9.0-rc.0</b> - 2019-08-05
</li>
<li>
<b>16.9.0-alpha.0</b> - 2019-04-03
</li>
<li>
<b>16.8.6</b> - 2019-03-28
</li>
<li>
<b>16.8.5</b> - 2019-03-22
</li>
<li>
<b>16.8.4</b> - 2019-03-05
</li>
</ul>
from <a
href="https://redirect.github.com/facebook/react/releases">react-dom
GitHub release notes</a>
</details>
</details>
---
> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.
---
**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._
**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI4NTdmYmVkYy1hZTE3LTQ3ZGYtODhkYy03MTcyMWYxNThjZTkiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6Ijg1N2ZiZWRjLWFlMTctNDdkZi04OGRjLTcxNzIxZjE1OGNlOSJ9fQ=="
width="0" height="0"/>
> - 🧐 [View latest project
report](https://app.snyk.io/org/newkdr/project/12a8a5f5-3e19-438c-8280-eb8f4ee06d17?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/newkdr/project/12a8a5f5-3e19-438c-8280-eb8f4ee06d17/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/newkdr/project/12a8a5f5-3e19-438c-8280-eb8f4ee06d17/settings/integration?pkg&#x3D;react-dom&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)
[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"react-dom","from":"16.8.4","to":"16.14.0"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"857fbedc-ae17-47df-88dc-71721f158ce9","prPublicId":"857fbedc-ae17-47df-88dc-71721f158ce9","packageManager":"npm","priorityScoreList":[],"projectPublicId":"12a8a5f5-3e19-438c-8280-eb8f4ee06d17","projectUrl":"https://app.snyk.io/org/newkdr/project/12a8a5f5-3e19-438c-8280-eb8f4ee06d17?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":13,"publishedDate":"2020-10-14T19:38:26.085Z"},"vulns":[]}'
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
Fixes a bug where lower priority updates on a components wrapped with
`memo` are sometimes left dangling in the queue without ever being
processed, if they are preceded by a higher priority bailout.
Cause
-----
The pending update priority field is cleared at the beginning of
`beginWork`. If there is remaining work at a lower priority level, it's
expected that it will be accumulated on the work-in-progress fiber
during the begin phase.
There's an exception where this assumption doesn't hold:
SimpleMemoComponent contains a bailout that occurs *before* the
component is evaluated and the update queues are processed, which means
we don't accumulate the next priority level. When we complete the fiber,
the work loop is left to believe that there's no remaining work.
Mitigation
----------
Since this only happens in a single case, a late bailout in
SimpleMemoComponent, I've mitigated the bug in that code path by
restoring the original update priority from the current fiber.
This same case does not apply to MemoComponent, because MemoComponent
fibers do not contain hooks or update queues; rather, they wrap around
an inner fiber that may contain those. However, I've added a test case
for MemoComponent to protect against a possible future regression.
Possible next steps
-------------------
We should consider moving the update priority assignment in `beginWork`
out of the common path and into each branch, to avoid similar bugs in
the future.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@acdlite@sizebot@dai-shi@sebmarkbage@facebook-github-bot