Skip to content

feat<Compiler>: consider that the dispatch function from useReducer is non-reactive#29705

Merged
josephsavona merged 4 commits into
react:mainfrom
TrickyPi:xiaopi/useSelector-dispatcher-non-reactive
Jun 5, 2024
Merged

feat<Compiler>: consider that the dispatch function from useReducer is non-reactive#29705
josephsavona merged 4 commits into
react:mainfrom
TrickyPi:xiaopi/useSelector-dispatcher-non-reactive

Conversation

@TrickyPi

@TrickyPi TrickyPi commented Jun 1, 2024

Copy link
Copy Markdown
Contributor

Summary

The dispatch function from useReducer is stable, so it is also non-reactive.

the related PR: #29665
the related comment: #29674 (comment)

I am not sure if the location of the new test file is appropriate😅.

How did you test this change?

Added the specific test compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useReducer-returned-dispatcher-is-non-reactive.expect.md.

@vercel

vercel Bot commented Jun 1, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2024 2:34am

@TrickyPi TrickyPi changed the title feat<Compiler>: Consider dispatch from useReducer is non-reactive feat<Compiler>: the dispatch function from useReducer is non-reactive Jun 1, 2024
@TrickyPi TrickyPi changed the title feat<Compiler>: the dispatch function from useReducer is non-reactive feat<Compiler>: consider that the dispatch function from useReducer is non-reactive Jun 1, 2024
@react-sizebot

react-sizebot commented Jun 1, 2024

Copy link
Copy Markdown

Comparing: d77dd31...8353f1f

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.js = 6.66 kB 6.66 kB +0.05% 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 496.48 kB 496.48 kB = 88.87 kB 88.87 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 501.30 kB 501.30 kB = 89.56 kB 89.56 kB
facebook-www/ReactDOM-prod.classic.js = 593.97 kB 593.97 kB = 104.48 kB 104.49 kB
facebook-www/ReactDOM-prod.modern.js = 570.35 kB 570.35 kB = 100.89 kB 100.89 kB
test_utils/ReactAllWarnings.js Deleted 63.65 kB 0.00 kB Deleted 15.90 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 63.65 kB 0.00 kB Deleted 15.90 kB 0.00 kB

Generated by 🚫 dangerJS against 8353f1f

@josephsavona josephsavona left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Exciting, thanks for putting up a PR! Just some quick feedback, will do a full review next week

Comment thread compiler/apps/playground/components/TabbedWindow.tsx
Comment thread compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts Outdated
@TrickyPi

TrickyPi commented Jun 2, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for your review! The required changes have been made.

@josephsavona josephsavona left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

awesome, thanks!

@josephsavona josephsavona left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like you need to run prettier

@TrickyPi

TrickyPi commented Jun 4, 2024

Copy link
Copy Markdown
Contributor Author

Oh, I forgot. Now it's fixed.

@TrickyPi TrickyPi force-pushed the xiaopi/useSelector-dispatcher-non-reactive branch from 610cde5 to 8353f1f Compare June 4, 2024 02:31
@josephsavona josephsavona merged commit 704aeed into react:main Jun 5, 2024
@josephsavona

Copy link
Copy Markdown
Contributor

Awesome, thanks!

github-actions Bot pushed a commit that referenced this pull request Jun 5, 2024
… is non-reactive (#29705)

Summary
The dispatch function from useReducer is stable, so it is also non-reactive.

the related PR: #29665
the related comment: #29674 (comment)

I am not sure if the location of the new test file is appropriate😅.

How did you test this change?
Added the specific test compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useReducer-returned-dispatcher-is-non-reactive.expect.md.

DiffTrain build for commit 704aeed.
@TrickyPi TrickyPi deleted the xiaopi/useSelector-dispatcher-non-reactive branch June 6, 2024 07:43
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.

4 participants