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

[crud] Remove useResourceEffect #32206

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

[crud] Remove useResourceEffect #32206

wants to merge 4 commits into from

Conversation

poteto
Copy link
Member

@poteto poteto commented Jan 23, 2025

@react-sizebot
Copy link

react-sizebot commented Jan 23, 2025

Comparing: 221f300...e9e1404

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.68 kB 6.68 kB +0.05% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.03% 514.64 kB 514.78 kB +0.04% 91.76 kB 91.80 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.03% 557.67 kB 557.81 kB +0.04% 99.01 kB 99.05 kB
facebook-www/ReactDOM-prod.classic.js = 596.61 kB 596.37 kB +0.14% 104.89 kB 105.04 kB
facebook-www/ReactDOM-prod.modern.js = 587.04 kB 586.80 kB +0.14% 103.36 kB 103.50 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react/cjs/react.production.js +1.07% 17.00 kB 17.18 kB +1.47% 4.42 kB 4.49 kB
oss-stable/react/cjs/react.production.js +1.07% 17.02 kB 17.21 kB +1.48% 4.45 kB 4.52 kB
oss-experimental/react/cjs/react.production.js +0.72% 18.42 kB 18.56 kB +1.07% 4.77 kB 4.82 kB
oss-stable-semver/react/cjs/react.development.js +0.36% 56.13 kB 56.33 kB +0.45% 12.49 kB 12.55 kB
oss-stable/react/cjs/react.development.js +0.36% 56.16 kB 56.36 kB +0.45% 12.52 kB 12.57 kB
oss-experimental/react/cjs/react.development.js +0.32% 46.15 kB 46.30 kB +0.43% 10.53 kB 10.57 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 28.29 kB = 5.64 kB 5.60 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 28.29 kB = 5.64 kB 5.60 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 28.29 kB = 5.64 kB 5.60 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.74 kB = 5.77 kB 5.73 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.74 kB = 5.77 kB 5.73 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.74 kB = 5.77 kB 5.73 kB

Generated by 🚫 dangerJS against 1b22073

Small refactor to the `resource` type to narrow it to an arbitrary object or void/null instead of the top type. This makes the overload on useEffect simpler since the return type of create is no longer widened to the top type when we merge their definitions.
Rename the flag in preparation for the overload.
Merges the useResourceEffect API into useEffect while keeping the underlying implementation the same. useResourceEffect will be removed in the next diff.

To fork between behavior we rely on a `typeof` check for the updater or destroy function in addition to the CRUD feature flag. This does now have to be checked every time (instead of inlined statically like before due to them being different hooks) which will incur some non-zero amount (possibly negligble) of overhead for every effect.
Removes useResourceEffect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants