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

fix: Run reducers with the props from the queued update #21419

Closed
wants to merge 2 commits into from

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented May 3, 2021

Summary

Closes #21416
Closes #17953
I don't fully understand the fix yet but it worked so I'm trying my luck with CI 🤷‍♂️ and test https://twitter.com/dan_abramov/status/1402015574780170240

Test Plan

  • failed locally without fix
  • CI greem with naive fix

@sizebot
Copy link

sizebot commented May 3, 2021

Comparing: 2442d98...2a092ae

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js +0.03% 127.41 kB 127.45 kB +0.01% 40.83 kB 40.84 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.03% 130.22 kB 130.26 kB +0.02% 41.74 kB 41.75 kB
facebook-www/ReactDOM-prod.classic.js +0.03% 405.65 kB 405.76 kB +0.03% 74.99 kB 75.02 kB
facebook-www/ReactDOM-prod.modern.js +0.03% 394.08 kB 394.19 kB +0.03% 73.22 kB 73.25 kB
facebook-www/ReactDOMForked-prod.classic.js +0.03% 405.65 kB 405.76 kB +0.03% 75.00 kB 75.02 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 2a092ae

@eps1lon eps1lon marked this pull request as ready for review May 3, 2021 21:40
@billyjanitsch
Copy link
Contributor

It seems like this was previously acknowledged as a bug: #17953 (comment), from a duplicate issue.

@eps1lon do you think it might be reasonable to ping a maintainer for a brief look? With respect to their time, I wonder if this PR was overlooked because the title doesn't suggest that it includes a fix. Obviously there's a chance that it turns out to be more subtle, but maybe it turns out to be an easy merge?

@eps1lon eps1lon changed the title test: Add current behavior for reducers with closures fix: Run reducers with the props from the queued update Jun 8, 2021
@eps1lon
Copy link
Collaborator Author

eps1lon commented Jun 8, 2021

@eps1lon do you think it might be reasonable to ping a maintainer for a brief look?

I didn't want to waste their time but it seems like @gaearon is at least sympathetic towards test + bad fix (https://twitter.com/dan_abramov/status/1402015574780170240) so maybe you're right.

@gaearon
Copy link
Collaborator

gaearon commented Jun 8, 2021

I don't fully understand the fix yet

This seems pretty important. :) we wouldn’t want to replace one set of mistakes with another set of mistakes, and to avoid this we need to understand precisely how this fix works. I haven’t looked but it would be helpful if someone dug into it and explained it.

In either case, addressing this is on the todo list, and we’ll get to it before the next major release. We likely can’t fix it in a minor anyway because it’s too risky. We were planning for a wider fix (eg entirely removing the bailout mechanism for reducers specifically) but we’ll include reviewing this change as a prerequisite to this work.

@eps1lon
Copy link
Collaborator Author

eps1lon commented Jun 8, 2021

I don't fully understand the fix yet

This seems pretty important. :)

Agreed. I was just hoping for

PR bait: when you send a bad fix and nerd-snipe a colleague into fixing it properly.

-- https://twitter.com/dan_abramov/status/1402015574780170240

😛

@eps1lon eps1lon force-pushed the fix/reducer-closures branch from dd404d0 to 765ae43 Compare June 30, 2021 12:26
@eps1lon eps1lon changed the base branch from master to main June 30, 2021 12:30
@eps1lon eps1lon force-pushed the fix/reducer-closures branch from 765ae43 to 2a092ae Compare June 30, 2021 12:45
josephsavona added a commit to josephsavona/react that referenced this pull request Sep 27, 2021
acdlite pushed a commit that referenced this pull request Sep 27, 2021
* Fork dispatchAction for useState/useReducer

* Remove eager bailout from forked dispatchReducerAction, update tests

* Update eager reducer/state logic to handle state case only

* sync reconciler fork

* rename test

* test cases from #15198

* comments on new test cases

* comments on new test cases

* test case from #21419

* minor tweak to test name to kick CI
@eps1lon eps1lon deleted the fix/reducer-closures branch September 28, 2021 06:41
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
* Fork dispatchAction for useState/useReducer

* Remove eager bailout from forked dispatchReducerAction, update tests

* Update eager reducer/state logic to handle state case only

* sync reconciler fork

* rename test

* test cases from facebook#15198

* comments on new test cases

* comments on new test cases

* test case from facebook#21419

* minor tweak to test name to kick CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants