Skip to content
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

[Bugfix] Updates "un-committed" when rebasing #17430

Closed
wants to merge 3 commits into from

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Nov 21, 2019

To enforce that updates that are committed can never be un-committed, even during a rebase, we need to track which updates are part of the rebase. The current implementation doesn't do this properly. It has a hidden assumption that, when rebasing, the next renderExpirationTime will represent a later expiration time that the original one. That's usually true, but it's not always true: there could be another update at even higher priority.

This requires two extra fields on the update queue. I really don't like that the update queue logic has gotten even more complicated. It's tempting to say that we should remove rebasing entirely, and that update queues must always be updated at the same priority. But I'm hesitant to jump to that conclusion — rebasing can be confusing in the edge cases, but it's also convenient. Enforcing single-priority queues would really hurt the ergonomics of useReducer, for example, where multiple values are centralized in a single queue. It especially hurts the ergonomics of classes, where there's only a single queue per class.

So it's something to think about, but I don't think "no more rebasing" is an acceptable answer on its own.

Adds a failing test case where an update that was committed is
later skipped over during a rebase. This should never happen.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 21, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 97ec757:

Sandbox Source
wild-water-fbycf Configuration

@sizebot
Copy link

sizebot commented Nov 21, 2019

Details of bundled changes.

Comparing: 54f6673...97ec757

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.production.min.js 🔺+0.3% 🔺+0.5% 72.37 KB 72.62 KB 21.34 KB 21.45 KB NODE_PROD
react-reconciler-persistent.development.js +0.3% +0.5% 602.81 KB 604.81 KB 126.82 KB 127.4 KB NODE_DEV
react-reconciler-persistent.production.min.js 🔺+0.3% 🔺+0.5% 72.38 KB 72.63 KB 21.34 KB 21.45 KB NODE_PROD
react-reconciler.development.js +0.3% +0.4% 605.34 KB 607.34 KB 127.93 KB 128.49 KB NODE_DEV

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.46 KB 10.46 KB 3.57 KB 3.57 KB NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 136.37 KB 136.37 KB 35.91 KB 35.91 KB NODE_DEV
react-dom.development.js +0.2% +0.3% 954.03 KB 956.03 KB 215.65 KB 216.22 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.85 KB 19.85 KB 7.38 KB 7.38 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.87 KB 3.87 KB 1.54 KB 1.54 KB UMD_DEV
react-dom.production.min.js 🔺+0.2% 🔺+0.3% 116.18 KB 116.42 KB 37.45 KB 37.56 KB UMD_PROD
react-dom.profiling.min.js +0.2% +0.3% 119.75 KB 119.98 KB 38.56 KB 38.66 KB UMD_PROFILING
react-dom.development.js +0.2% +0.3% 948.1 KB 950.1 KB 214.07 KB 214.65 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.7 KB 3.7 KB 1.5 KB 1.49 KB NODE_DEV
react-dom.production.min.js 🔺+0.2% 🔺+0.3% 116.29 KB 116.53 KB 36.86 KB 36.97 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1.04 KB 1.04 KB 635 B 634 B NODE_PROD
react-dom.profiling.min.js +0.2% +0.3% 119.98 KB 120.22 KB 37.87 KB 37.99 KB NODE_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.72 KB 10.72 KB 3.67 KB 3.67 KB UMD_PROD
react-dom-server.node.development.js 0.0% -0.0% 137.48 KB 137.48 KB 36.13 KB 36.13 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.1% 11.17 KB 11.17 KB 4.14 KB 4.14 KB UMD_PROD
react-dom-test-utils.production.min.js 0.0% -0.1% 10.94 KB 10.94 KB 4.08 KB 4.08 KB NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 140.44 KB 140.44 KB 36.91 KB 36.91 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.93 KB 19.93 KB 7.39 KB 7.38 KB UMD_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.3% +0.4% 673.67 KB 675.67 KB 146.13 KB 146.7 KB UMD_DEV
react-art.production.min.js 🔺+0.2% 🔺+0.4% 104.59 KB 104.83 KB 31.82 KB 31.94 KB UMD_PROD
react-art.development.js +0.3% +0.4% 604.3 KB 606.3 KB 128.74 KB 129.31 KB NODE_DEV
react-art.production.min.js 🔺+0.3% 🔺+0.4% 69.61 KB 69.85 KB 21.03 KB 21.12 KB NODE_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.3% +0.4% 618.57 KB 620.58 KB 131.82 KB 132.38 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.3% 🔺+0.4% 71.62 KB 71.86 KB 21.93 KB 22.03 KB UMD_PROD
react-test-renderer.development.js +0.3% +0.4% 613.84 KB 615.84 KB 130.63 KB 131.21 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.3% 🔺+0.6% 71.33 KB 71.57 KB 21.54 KB 21.67 KB NODE_PROD
react-test-renderer-shallow.development.js 0.0% 0.0% 39.1 KB 39.1 KB 10 KB 10 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.58 KB 11.58 KB 3.58 KB 3.58 KB UMD_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.3% +0.3% 749.8 KB 751.88 KB 158.73 KB 159.27 KB RN_FB_DEV
ReactNativeRenderer-prod.js 🔺+0.2% 🔺+0.4% 277.31 KB 277.95 KB 47.54 KB 47.72 KB RN_FB_PROD
ReactNativeRenderer-profiling.js +0.2% +0.4% 286.26 KB 286.91 KB 49.26 KB 49.44 KB RN_FB_PROFILING
ReactFabric-dev.js +0.3% +0.3% 755.22 KB 757.29 KB 159.56 KB 160.09 KB RN_FB_DEV
ReactFabric-prod.js 🔺+0.2% 🔺+0.4% 268.96 KB 269.61 KB 46.1 KB 46.29 KB RN_FB_PROD
ReactFabric-profiling.js +0.2% +0.4% 279.1 KB 279.74 KB 47.98 KB 48.17 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js +0.3% +0.3% 749.63 KB 751.7 KB 158.65 KB 159.19 KB RN_OSS_DEV
ReactNativeRenderer-prod.js 🔺+0.2% 🔺+0.4% 276.92 KB 277.56 KB 47.46 KB 47.65 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +0.2% +0.4% 285.88 KB 286.52 KB 49.19 KB 49.37 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.3% +0.3% 755.04 KB 757.11 KB 159.48 KB 160.01 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.2% 🔺+0.4% 268.62 KB 269.26 KB 46.03 KB 46.21 KB RN_OSS_PROD
ReactFabric-profiling.js +0.2% +0.4% 278.75 KB 279.39 KB 47.91 KB 48.1 KB RN_OSS_PROFILING

ReactDOM: size: 🔺+0.2%, gzip: 🔺+0.3%

Size changes (stable)

Generated by 🚫 dangerJS against 97ec757

@sizebot
Copy link

sizebot commented Nov 21, 2019

Details of bundled changes.

Comparing: 54f6673...97ec757

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js +0.3% +0.5% 123.53 KB 123.9 KB 38.84 KB 39.04 KB NODE_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.88 KB 3.88 KB 1.55 KB 1.55 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 11.18 KB 11.18 KB 4.15 KB 4.15 KB UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.71 KB 3.71 KB 1.5 KB 1.5 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.1% 10.95 KB 10.95 KB 4.09 KB 4.09 KB NODE_PROD
react-dom.development.js +0.2% +0.3% 954.05 KB 956.05 KB 215.67 KB 216.24 KB UMD_DEV
react-dom.production.min.js 🔺+0.3% 🔺+0.5% 119.59 KB 119.96 KB 38.42 KB 38.59 KB UMD_PROD
react-dom.profiling.min.js +0.3% +0.5% 123.27 KB 123.63 KB 39.53 KB 39.72 KB UMD_PROFILING
react-dom.development.js +0.2% +0.3% 948.12 KB 950.12 KB 214.09 KB 214.67 KB NODE_DEV
react-dom.production.min.js 🔺+0.3% 🔺+0.6% 119.73 KB 120.09 KB 37.79 KB 38 KB NODE_PROD
react-dom-server.browser.production.min.js 0.0% 0.0% 20.31 KB 20.31 KB 7.46 KB 7.46 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.14 KB 60.14 KB 15.8 KB 15.8 KB UMD_DEV
ReactDOM-dev.js +0.2% +0.3% 976.15 KB 978.23 KB 216.61 KB 217.18 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.3% 🔺+0.4% 402.83 KB 403.95 KB 73.37 KB 73.66 KB FB_WWW_PROD
ReactDOM-profiling.js +0.3% +0.4% 403.79 KB 404.91 KB 73.89 KB 74.18 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.48 KB 10.48 KB 3.58 KB 3.58 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactFabric-prod.js 🔺+0.4% 🔺+0.7% 268.98 KB 270.1 KB 46.11 KB 46.42 KB RN_FB_PROD
ReactNativeRenderer-dev.js +0.3% +0.3% 749.64 KB 751.71 KB 158.66 KB 159.19 KB RN_OSS_DEV
ReactFabric-profiling.js +0.4% +0.6% 279.11 KB 280.23 KB 47.99 KB 48.29 KB RN_FB_PROFILING
ReactNativeRenderer-prod.js 🔺+0.4% 🔺+0.6% 277.32 KB 278.44 KB 47.55 KB 47.84 KB RN_FB_PROD
ReactNativeRenderer-profiling.js +0.4% +0.6% 286.28 KB 287.4 KB 49.27 KB 49.57 KB RN_FB_PROFILING
ReactFabric-dev.js +0.3% +0.3% 755.05 KB 757.12 KB 159.49 KB 160.02 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.4% 🔺+0.7% 268.63 KB 269.75 KB 46.04 KB 46.34 KB RN_OSS_PROD
ReactFabric-profiling.js +0.4% +0.6% 278.76 KB 279.89 KB 47.92 KB 48.22 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.3% +0.3% 755.24 KB 757.31 KB 159.57 KB 160.1 KB RN_FB_DEV
ReactNativeRenderer-prod.js 🔺+0.4% 🔺+0.6% 276.93 KB 278.05 KB 47.47 KB 47.76 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +0.4% +0.6% 285.89 KB 287.01 KB 49.2 KB 49.5 KB RN_OSS_PROFILING
ReactNativeRenderer-dev.js +0.3% +0.3% 749.82 KB 751.89 KB 158.74 KB 159.28 KB RN_FB_DEV

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.3% +0.4% 618.6 KB 620.6 KB 131.83 KB 132.39 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.5% 🔺+0.9% 71.65 KB 72.02 KB 21.95 KB 22.15 KB UMD_PROD
ReactTestRenderer-dev.js +0.3% +0.4% 629.37 KB 631.44 KB 131.02 KB 131.56 KB FB_WWW_DEV
react-test-renderer.development.js +0.3% +0.4% 613.87 KB 615.87 KB 130.64 KB 131.22 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.5% 🔺+0.9% 71.35 KB 71.71 KB 21.56 KB 21.76 KB NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js +0.3% +0.4% 617.7 KB 619.77 KB 128.45 KB 128.98 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.5% 🔺+0.8% 236.13 KB 237.25 KB 39.79 KB 40.1 KB FB_WWW_PROD
react-art.development.js +0.3% +0.4% 673.69 KB 675.69 KB 146.13 KB 146.71 KB UMD_DEV
react-art.production.min.js 🔺+0.3% 🔺+0.5% 106.67 KB 107.04 KB 32.42 KB 32.58 KB UMD_PROD
react-art.development.js +0.3% +0.4% 604.33 KB 606.33 KB 128.74 KB 129.32 KB NODE_DEV
react-art.production.min.js 🔺+0.5% 🔺+1.0% 71.64 KB 72 KB 21.48 KB 21.69 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-persistent.development.js +0.3% +0.5% 602.82 KB 604.82 KB 126.83 KB 127.41 KB NODE_DEV
react-reconciler-persistent.production.min.js 🔺+0.5% 🔺+0.8% 72.4 KB 72.76 KB 21.35 KB 21.51 KB NODE_PROD
react-reconciler.development.js +0.3% +0.4% 605.35 KB 607.35 KB 127.93 KB 128.49 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.5% 🔺+0.8% 74.67 KB 75.04 KB 21.9 KB 22.07 KB NODE_PROD

Size changes (experimental)

Generated by 🚫 dangerJS against 97ec757

@acdlite acdlite changed the title [Failing test] Updates "un-committed" when rebasing [Bugfix] Updates "un-committed" when rebasing Nov 22, 2019
To enforce that updates that are committed can never be un-committed,
even during a rebase, we need to track which updates are part of the
rebase. The current implementation doesn't do this properly. It has a
hidden assumption that, when rebasing, the next `renderExpirationTime`
will represent a later expiration time that the original one. That's
usually true, but it's not *always* true: there could be another update
at even higher priority.

This requires two extra fields on the update queue. I really don't like
that the update queue logic has gotten even more complicated. It's
tempting to say that we should remove rebasing entirely, and that update
queues must always be updated at the same priority. But I'm hesitant to
jump to that conclusion — rebasing can be confusing in the edge cases,
but it's also convenient. Enforcing single-priority queues would really
hurt the ergonomics of useReducer, for example, where multiple values
are centralized in a single queue. It especially hurts the ergonomics
of classes, where there's only a single queue per class.

So it's something to think about, but I don't think "no more rebasing"
is an acceptable answer on its own.
newBaseUpdate = prevUpdate;
newBaseState = newState;
newRebaseTime = renderExpirationTime;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh I think this should be the lower of renderExpirationTime and the old rebaseTime. In case there are two rebases in a row. I'll add a new test.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also have to be the further of the two RebaseEnd then, no?

Copy link
Collaborator Author

@acdlite acdlite Nov 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I don't think this will work. There can be arbitrary numbers of rebases, each with their own ranges and expiration times.

Will need to reevaluate.

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highly unsatisfying.

@acdlite
Copy link
Collaborator Author

acdlite commented Dec 2, 2019

The approach here won't work because of #17430 (comment)

Closing in favor of #17483 stack

@acdlite acdlite closed this Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants