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] Basic implementation #31523

Merged
merged 1 commit into from
Nov 18, 2024
Merged

[crud] Basic implementation #31523

merged 1 commit into from
Nov 18, 2024

Conversation

poteto
Copy link
Member

@poteto poteto commented Nov 12, 2024

This PR introduces a new experimental hook useResourceEffect, which is something that we're doing some very early initial tests on.

This may likely not pan out and will be removed or modified if so. Please do not rely on it as it will break.

Copy link

vercel bot commented Nov 12, 2024

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 Nov 18, 2024 3:04pm

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Nov 12, 2024
@react-sizebot
Copy link

react-sizebot commented Nov 12, 2024

Comparing: 92c0f5f...21619eb

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 = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.04% 509.76 kB 509.94 kB +0.14% 91.11 kB 91.24 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.04% 514.69 kB 514.88 kB +0.13% 91.83 kB 91.95 kB
facebook-www/ReactDOM-prod.classic.js +0.88% 589.38 kB 594.55 kB +0.57% 104.30 kB 104.90 kB
facebook-www/ReactDOM-prod.modern.js +0.89% 579.65 kB 584.81 kB +0.58% 102.72 kB 103.32 kB
facebook-react-native/react/cjs/React-prod.js +2.23% 18.74 kB 19.15 kB +2.26% 4.86 kB 4.97 kB
facebook-react-native/react/cjs/React-profiling.js +2.18% 19.17 kB 19.59 kB +2.23% 4.94 kB 5.05 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-react-native/react/cjs/React-prod.js +2.23% 18.74 kB 19.15 kB +2.26% 4.86 kB 4.97 kB
facebook-react-native/react/cjs/React-profiling.js +2.18% 19.17 kB 19.59 kB +2.23% 4.94 kB 5.05 kB
facebook-www/React-prod.modern.js +1.92% 20.34 kB 20.73 kB +1.79% 5.20 kB 5.29 kB
facebook-www/React-prod.classic.js +1.92% 20.34 kB 20.73 kB +1.79% 5.20 kB 5.29 kB
facebook-www/ReactART-dev.modern.js +1.91% 633.39 kB 645.51 kB +1.40% 101.26 kB 102.68 kB
facebook-www/ReactART-dev.classic.js +1.88% 643.28 kB 655.40 kB +1.40% 103.23 kB 104.68 kB
facebook-www/React-profiling.modern.js +1.88% 20.77 kB 21.16 kB +1.78% 5.28 kB 5.37 kB
facebook-www/React-profiling.classic.js +1.88% 20.77 kB 21.16 kB +1.76% 5.28 kB 5.37 kB
react-native/implementations/ReactFabric-dev.fb.js +1.85% 654.75 kB 666.87 kB +1.34% 107.26 kB 108.69 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +1.83% 661.86 kB 673.98 kB +1.33% 108.65 kB 110.10 kB
facebook-www/ReactReconciler-dev.modern.js +1.69% 718.75 kB 730.88 kB +1.10% 114.23 kB 115.48 kB
facebook-www/ReactReconciler-dev.classic.js +1.67% 728.26 kB 740.39 kB +1.12% 116.04 kB 117.34 kB
facebook-www/ReactART-prod.modern.js +1.46% 352.76 kB 357.92 kB +0.97% 59.72 kB 60.30 kB
facebook-www/ReactART-prod.classic.js +1.42% 362.49 kB 367.65 kB +0.83% 61.27 kB 61.78 kB
react-native/implementations/ReactFabric-prod.fb.js +1.38% 374.89 kB 380.05 kB +1.00% 65.61 kB 66.27 kB
react-native/implementations/ReactNativeRenderer-prod.fb.js +1.36% 380.50 kB 385.66 kB +1.01% 66.70 kB 67.38 kB
react-native/implementations/ReactFabric-profiling.fb.js +1.27% 400.57 kB 405.67 kB +0.97% 69.49 kB 70.16 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +1.26% 406.14 kB 411.24 kB +0.89% 70.57 kB 71.20 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-dev.js +1.25% 971.30 kB 983.47 kB +0.95% 164.09 kB 165.65 kB
facebook-www/ReactReconciler-prod.modern.js +1.24% 444.79 kB 450.31 kB +0.80% 72.20 kB 72.78 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-dev.js +1.23% 987.65 kB 999.81 kB +0.94% 166.91 kB 168.48 kB
facebook-www/ReactReconciler-prod.classic.js +1.21% 455.11 kB 460.63 kB +0.78% 73.74 kB 74.32 kB
facebook-www/ReactDOM-dev.modern.js +1.16% 1,051.83 kB 1,064.00 kB +0.80% 176.32 kB 177.73 kB
facebook-www/ReactDOM-dev.classic.js +1.15% 1,061.28 kB 1,073.45 kB +0.81% 178.09 kB 179.53 kB
facebook-www/ReactDOMTesting-dev.modern.js +1.14% 1,068.74 kB 1,080.91 kB +0.81% 180.20 kB 181.66 kB
facebook-www/ReactDOMTesting-dev.classic.js +1.13% 1,078.19 kB 1,090.36 kB +0.78% 182.01 kB 183.43 kB
test_utils/ReactAllWarnings.js +1.04% 62.86 kB 63.51 kB +1.03% 15.66 kB 15.83 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-prod.js +0.97% 529.91 kB 535.07 kB +0.83% 94.43 kB 95.21 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-prod.js +0.96% 535.41 kB 540.57 kB +0.82% 95.50 kB 96.28 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-profiling.js +0.92% 554.96 kB 560.07 kB +0.77% 98.27 kB 99.02 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-profiling.js +0.91% 560.90 kB 566.01 kB +0.76% 99.42 kB 100.18 kB
facebook-www/ReactDOM-prod.modern.js +0.89% 579.65 kB 584.81 kB +0.58% 102.72 kB 103.32 kB
facebook-www/ReactDOM-prod.classic.js +0.88% 589.38 kB 594.55 kB +0.57% 104.30 kB 104.90 kB
facebook-www/ReactDOMTesting-prod.modern.js +0.87% 594.37 kB 599.53 kB +0.55% 106.42 kB 107.01 kB
facebook-www/ReactDOMTesting-prod.classic.js +0.85% 604.10 kB 609.27 kB +0.53% 107.99 kB 108.56 kB
facebook-www/ReactDOM-profiling.modern.js +0.84% 606.78 kB 611.88 kB +0.55% 106.55 kB 107.14 kB
facebook-www/ReactDOM-profiling.classic.js +0.83% 616.56 kB 621.66 kB +0.52% 108.20 kB 108.76 kB
facebook-react-native/react/cjs/React-dev.js +0.78% 62.84 kB 63.32 kB +0.75% 14.07 kB 14.18 kB
facebook-www/React-dev.modern.js +0.69% 67.57 kB 68.04 kB +0.64% 14.93 kB 15.03 kB
facebook-www/React-dev.classic.js +0.69% 67.58 kB 68.04 kB +0.64% 14.93 kB 15.03 kB
oss-experimental/react/cjs/react.production.js +0.51% 18.07 kB 18.17 kB +0.40% 4.69 kB 4.71 kB
oss-stable-rc/react-test-renderer/cjs/react-test-renderer.development.js +0.41% 551.02 kB 553.25 kB +0.21% 90.09 kB 90.28 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.development.js +0.41% 551.02 kB 553.25 kB +0.21% 90.09 kB 90.28 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.development.js +0.41% 551.04 kB 553.28 kB +0.21% 90.10 kB 90.29 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.development.js +0.41% 551.08 kB 553.31 kB +0.21% 90.11 kB 90.30 kB
oss-stable-rc/react-art/cjs/react-art.development.js +0.40% 554.96 kB 557.19 kB +0.24% 89.81 kB 90.02 kB
oss-stable-semver/react-art/cjs/react-art.development.js +0.40% 554.96 kB 557.19 kB +0.24% 89.81 kB 90.02 kB
oss-stable/react-art/cjs/react-art.development.js +0.40% 555.02 kB 557.25 kB +0.24% 89.83 kB 90.05 kB
facebook-www/ReactTestRenderer-dev.modern.js +0.39% 575.40 kB 577.64 kB +0.27% 94.17 kB 94.43 kB
facebook-www/ReactTestRenderer-dev.classic.js +0.39% 575.40 kB 577.64 kB +0.27% 94.17 kB 94.43 kB
oss-experimental/react-art/cjs/react-art.development.js +0.39% 576.10 kB 578.34 kB +0.30% 93.02 kB 93.30 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js +0.38% 584.05 kB 586.29 kB +0.27% 95.12 kB 95.37 kB
oss-stable-rc/react-reconciler/cjs/react-reconciler.development.js +0.35% 638.32 kB 640.57 kB +0.15% 102.49 kB 102.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.development.js +0.35% 638.32 kB 640.57 kB +0.15% 102.49 kB 102.65 kB
oss-stable/react-reconciler/cjs/react-reconciler.development.js +0.35% 638.34 kB 640.59 kB +0.15% 102.51 kB 102.67 kB
react-native/implementations/ReactFabric-dev.js +0.35% 636.58 kB 638.82 kB +0.23% 104.16 kB 104.40 kB
react-native/implementations/ReactNativeRenderer-dev.js +0.35% 646.33 kB 648.57 kB +0.23% 105.84 kB 106.09 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.34% 658.74 kB 660.99 kB +0.14% 105.63 kB 105.78 kB
oss-stable-rc/react-dom/cjs/react-dom-client.development.js +0.24% 940.39 kB 942.68 kB +0.28% 159.08 kB 159.53 kB
oss-stable-semver/react-dom/cjs/react-dom-client.development.js +0.24% 940.39 kB 942.68 kB +0.28% 159.08 kB 159.53 kB
oss-stable/react-dom/cjs/react-dom-client.development.js +0.24% 940.50 kB 942.78 kB +0.28% 159.11 kB 159.55 kB
oss-stable-rc/react-dom/cjs/react-dom-profiling.development.js +0.24% 956.84 kB 959.12 kB +0.27% 161.91 kB 162.35 kB
oss-stable-semver/react-dom/cjs/react-dom-profiling.development.js +0.24% 956.84 kB 959.12 kB +0.27% 161.91 kB 162.35 kB
oss-stable/react-dom/cjs/react-dom-profiling.development.js +0.24% 956.94 kB 959.23 kB +0.27% 161.93 kB 162.37 kB
oss-experimental/react-dom/cjs/react-dom-client.development.js +0.24% 961.75 kB 964.03 kB +0.28% 162.50 kB 162.95 kB
oss-experimental/react-dom/cjs/react-dom-profiling.development.js +0.23% 978.19 kB 980.47 kB +0.27% 165.33 kB 165.78 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +0.23% 978.69 kB 980.97 kB +0.27% 166.28 kB 166.73 kB
oss-experimental/react/cjs/react.development.js +0.23% 45.59 kB 45.69 kB +0.20% 10.42 kB 10.44 kB

Generated by 🚫 dangerJS against ed71fc2

packages/react-reconciler/src/ReactFiberCommitEffects.js Outdated Show resolved Hide resolved
packages/react-reconciler/src/ReactFiberCommitEffects.js Outdated Show resolved Hide resolved
packages/react-reconciler/src/ReactFiberHooks.js Outdated Show resolved Hide resolved
});

// @gate enableUseResourceEffectHook
it('calls update on every render if no deps are specified', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh didn't realize we were supporting this case in my comment above. Should we require null to be more explicit, or would you rather follow the current useEffect pattern for now? If we are more explicit while introducing this, it will be easier to compile later.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking that since we would eventually move to an overload, it'd be better to keep the existing pattern since that's in line with the existing mental model of how effect dependencies work

packages/shared/forks/ReactFeatureFlags.native-fb.js Outdated Show resolved Hide resolved
poteto added a commit that referenced this pull request Nov 15, 2024
Scaffolds the initial `useResourceEffect` dispatcher type. This will
eventually be folded into `useEffect` et al as an overload.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31555).
* #31523
* #31557
* #31556
* __->__ #31555
poteto added a commit that referenced this pull request Nov 15, 2024
Adds a new feature flag for `enableUseResourceEffectHook`.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31556).
* #31523
* #31557
* __->__ #31556
* #31555
poteto added a commit that referenced this pull request Nov 15, 2024
Adds a new `Effect` type which for now just points to the `SimpleEffect`
type, in prepartion for later in the stack where we add more.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31557).
* #31523
* __->__ #31557
* #31556
* #31555
This PR introduces a new experimental hook `useResourceEffect`, which is something that we're doing some very early initial tests on.

This may likely not pan out and will be removed or modified if so. Please do not rely on it as it will break.
github-actions bot pushed a commit that referenced this pull request Nov 15, 2024
Adds a new `Effect` type which for now just points to the `SimpleEffect`
type, in prepartion for later in the stack where we add more.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31557).
* #31523
* __->__ #31557
* #31556
* #31555

DiffTrain build for [053b3cb](053b3cb)
github-actions bot pushed a commit that referenced this pull request Nov 15, 2024
Adds a new `Effect` type which for now just points to the `SimpleEffect`
type, in prepartion for later in the stack where we add more.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31557).
* #31523
* __->__ #31557
* #31556
* #31555

DiffTrain build for [053b3cb](053b3cb)
@poteto poteto merged commit 047d95e into main Nov 18, 2024
357 of 359 checks passed
@poteto poteto deleted the poteto-crud branch November 18, 2024 15:16
github-actions bot pushed a commit that referenced this pull request Nov 18, 2024
This PR introduces a new experimental hook `useResourceEffect`, which is
something that we're doing some very early initial tests on.

This may likely not pan out and will be removed or modified if so.
Please do not rely on it as it will break.

DiffTrain build for [047d95e](047d95e)
github-actions bot pushed a commit that referenced this pull request Nov 18, 2024
This PR introduces a new experimental hook `useResourceEffect`, which is
something that we're doing some very early initial tests on.

This may likely not pan out and will be removed or modified if so.
Please do not rely on it as it will break.

DiffTrain build for [047d95e](047d95e)
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.

5 participants