@plasmicapp/loader-react 1.0.415 → 1.0.417

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -956,6 +956,19 @@ var PlasmicComponentLoader = class {
956
956
  }
957
957
  };
958
958
 
959
+ // src/react-utils.ts
960
+ var React2 = __toESM(require("react"));
961
+ var REACT_MAJOR_VERSION = +React2.version.split(".")[0];
962
+ function reactCurrentDispatcher() {
963
+ var _a2, _b, _c, _d, _e;
964
+ const r = React2;
965
+ if (REACT_MAJOR_VERSION <= 18) {
966
+ return (_b = (_a2 = r["__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED"]) == null ? void 0 : _a2.ReactCurrentDispatcher) == null ? void 0 : _b.current;
967
+ } else {
968
+ return (_e = (_c = r["__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE"]) == null ? void 0 : _c.H) != null ? _e : (_d = r["__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE"]) == null ? void 0 : _d.H;
969
+ }
970
+ }
971
+
959
972
  // src/swr-util.ts
960
973
  function swrSerialize(key) {
961
974
  if (typeof key === "function") {
@@ -1130,7 +1143,7 @@ var FakeReactComponent = (_a = class {
1130
1143
  }
1131
1144
  initRender(props) {
1132
1145
  this.props = props;
1133
- const dispatcher = import_react.default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current;
1146
+ const dispatcher = reactCurrentDispatcher();
1134
1147
  const [state, setState] = dispatcher.useState({});
1135
1148
  this.state = state;
1136
1149
  this.setState = setState;
@@ -1177,24 +1190,34 @@ var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoa
1177
1190
  [
1178
1191
  "useCallback",
1179
1192
  "useContext",
1193
+ "useDebugValue",
1180
1194
  "useEffect",
1181
1195
  "useImperativeHandle",
1182
- "useDebugValue",
1183
- "useInsertionEffect",
1184
1196
  "useLayoutEffect",
1185
1197
  "useMemo",
1186
- "useSyncExternalStore",
1187
1198
  "useReducer",
1188
1199
  "useRef",
1189
- "useState"
1200
+ "useState",
1201
+ // React 18+
1202
+ "useId",
1203
+ "useInsertionEffect",
1204
+ "useSyncExternalStore",
1205
+ // React 19+
1206
+ "use",
1207
+ "useActionState",
1208
+ "useEffectEvent",
1209
+ "useOptimistic"
1190
1210
  ].map((hook) => [
1191
1211
  hook,
1192
1212
  (...args) => {
1193
- const dispatcher = import_react.default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current;
1213
+ const dispatcher = reactCurrentDispatcher();
1194
1214
  return dispatcher[hook](...args);
1195
1215
  }
1196
1216
  ])
1197
1217
  )), {
1218
+ // TODO: ensure correct implementation in react-ssr-prepass and
1219
+ // merge with above array to rely on dispatcher
1220
+ // React 18+
1198
1221
  useDeferredValue: (v) => v,
1199
1222
  useTransition: () => [
1200
1223
  false,