Skip to content

Commit

Permalink
[crud] Basic implementation (#31523)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
poteto committed Nov 18, 2024
1 parent 215cf14 commit 3a9e9ff
Show file tree
Hide file tree
Showing 35 changed files with 56,123 additions and 51,319 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
92c0f5f85fed42024b17bf6595291f9f5d6e8734
047d95e85f0f0cfa6085b2e355e052a3c34ae24d
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
92c0f5f85fed42024b17bf6595291f9f5d6e8734
047d95e85f0f0cfa6085b2e355e052a3c34ae24d
20 changes: 19 additions & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,8 @@ __DEV__ &&
enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableUseResourceEffectHook =
dynamicFeatureFlags.enableUseResourceEffectHook,
renameElementSymbol = dynamicFeatureFlags.renameElementSymbol,
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = renameElementSymbol
Expand Down Expand Up @@ -1577,6 +1579,22 @@ __DEV__ &&
exports.experimental_useEffectEvent = function (callback) {
return resolveDispatcher().useEffectEvent(callback);
};
exports.experimental_useResourceEffect = function (
create,
createDeps,
update,
updateDeps,
destroy
) {
if (!enableUseResourceEffectHook) throw Error("Not implemented.");
return resolveDispatcher().useResourceEffect(
create,
createDeps,
update,
updateDeps,
destroy
);
};
exports.forwardRef = function (render) {
null != render && render.$$typeof === REACT_MEMO_TYPE
? error$jscomp$0(
Expand Down Expand Up @@ -1819,7 +1837,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-classic-92c0f5f8-20241115";
exports.version = "19.0.0-www-classic-047d95e8-20241118";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
20 changes: 19 additions & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,8 @@ __DEV__ &&
enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableUseResourceEffectHook =
dynamicFeatureFlags.enableUseResourceEffectHook,
renameElementSymbol = dynamicFeatureFlags.renameElementSymbol,
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = renameElementSymbol
Expand Down Expand Up @@ -1577,6 +1579,22 @@ __DEV__ &&
exports.experimental_useEffectEvent = function (callback) {
return resolveDispatcher().useEffectEvent(callback);
};
exports.experimental_useResourceEffect = function (
create,
createDeps,
update,
updateDeps,
destroy
) {
if (!enableUseResourceEffectHook) throw Error("Not implemented.");
return resolveDispatcher().useResourceEffect(
create,
createDeps,
update,
updateDeps,
destroy
);
};
exports.forwardRef = function (render) {
null != render && render.$$typeof === REACT_MEMO_TYPE
? error$jscomp$0(
Expand Down Expand Up @@ -1819,7 +1837,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-modern-92c0f5f8-20241115";
exports.version = "19.0.0-www-modern-047d95e8-20241118";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
19 changes: 18 additions & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"),
dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableUseResourceEffectHook = dynamicFeatureFlags.enableUseResourceEffectHook,
renameElementSymbol = dynamicFeatureFlags.renameElementSymbol,
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = renameElementSymbol
Expand Down Expand Up @@ -497,6 +498,22 @@ exports.createRef = function () {
exports.experimental_useEffectEvent = function (callback) {
return ReactSharedInternals.H.useEffectEvent(callback);
};
exports.experimental_useResourceEffect = function (
create,
createDeps,
update,
updateDeps,
destroy
) {
if (!enableUseResourceEffectHook) throw Error("Not implemented.");
return ReactSharedInternals.H.useResourceEffect(
create,
createDeps,
update,
updateDeps,
destroy
);
};
exports.forwardRef = function (render) {
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
};
Expand Down Expand Up @@ -619,4 +636,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-92c0f5f8-20241115";
exports.version = "19.0.0-www-classic-047d95e8-20241118";
19 changes: 18 additions & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"),
dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableUseResourceEffectHook = dynamicFeatureFlags.enableUseResourceEffectHook,
renameElementSymbol = dynamicFeatureFlags.renameElementSymbol,
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = renameElementSymbol
Expand Down Expand Up @@ -497,6 +498,22 @@ exports.createRef = function () {
exports.experimental_useEffectEvent = function (callback) {
return ReactSharedInternals.H.useEffectEvent(callback);
};
exports.experimental_useResourceEffect = function (
create,
createDeps,
update,
updateDeps,
destroy
) {
if (!enableUseResourceEffectHook) throw Error("Not implemented.");
return ReactSharedInternals.H.useResourceEffect(
create,
createDeps,
update,
updateDeps,
destroy
);
};
exports.forwardRef = function (render) {
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
};
Expand Down Expand Up @@ -619,4 +636,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-92c0f5f8-20241115";
exports.version = "19.0.0-www-modern-047d95e8-20241118";
19 changes: 18 additions & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"),
dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableUseResourceEffectHook = dynamicFeatureFlags.enableUseResourceEffectHook,
renameElementSymbol = dynamicFeatureFlags.renameElementSymbol,
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = renameElementSymbol
Expand Down Expand Up @@ -501,6 +502,22 @@ exports.createRef = function () {
exports.experimental_useEffectEvent = function (callback) {
return ReactSharedInternals.H.useEffectEvent(callback);
};
exports.experimental_useResourceEffect = function (
create,
createDeps,
update,
updateDeps,
destroy
) {
if (!enableUseResourceEffectHook) throw Error("Not implemented.");
return ReactSharedInternals.H.useResourceEffect(
create,
createDeps,
update,
updateDeps,
destroy
);
};
exports.forwardRef = function (render) {
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
};
Expand Down Expand Up @@ -623,7 +640,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-92c0f5f8-20241115";
exports.version = "19.0.0-www-classic-047d95e8-20241118";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
19 changes: 18 additions & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"),
dynamicFeatureFlags.disableDefaultPropsExceptForClasses,
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableUseResourceEffectHook = dynamicFeatureFlags.enableUseResourceEffectHook,
renameElementSymbol = dynamicFeatureFlags.renameElementSymbol,
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = renameElementSymbol
Expand Down Expand Up @@ -501,6 +502,22 @@ exports.createRef = function () {
exports.experimental_useEffectEvent = function (callback) {
return ReactSharedInternals.H.useEffectEvent(callback);
};
exports.experimental_useResourceEffect = function (
create,
createDeps,
update,
updateDeps,
destroy
) {
if (!enableUseResourceEffectHook) throw Error("Not implemented.");
return ReactSharedInternals.H.useResourceEffect(
create,
createDeps,
update,
updateDeps,
destroy
);
};
exports.forwardRef = function (render) {
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
};
Expand Down Expand Up @@ -623,7 +640,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-92c0f5f8-20241115";
exports.version = "19.0.0-www-modern-047d95e8-20241118";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Loading

0 comments on commit 3a9e9ff

Please sign in to comment.