@makeswift/runtime 0.5.2 → 0.5.3

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.
package/dist/index.es.js CHANGED
@@ -40,7 +40,7 @@ import { useEffect, createContext, useContext, useState, useMemo, useRef, Childr
40
40
  import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
41
41
  import dynamic from "next/dynamic";
42
42
  import { g as getPropControllerDescriptors, i as isElementReference, a as getElementSwatchIds, b as getFileIds, d as getTypographyIds, e as getTableIds, f as getPageIds, h as getElementChildren, j as createDocumentReference, k as getBorderSwatchIds, l as isNonNullable, m as getBoxShadowsSwatchIds, n as getResponsiveColorSwatchIds, o as getComponentPropControllerDescriptors, p as getPropControllers, q as configureStore$1, r as getDocument, s as getElementId, t as getIsInBuilder, u as copyElementTree, v as getReactComponent } from "./react-page.es.js";
43
- import { A as ActionTypes, f as introspectedResourcesFulfilled, g as apiResourceFulfilled, t as typographiesFulfilled, h as restoreAPIResourcesCache, j as registerComponentHandleEffect, k as mountComponentEffect, l as registerComponentEffect, n as registerReactComponentEffect } from "./actions.es.js";
43
+ import { A as ActionTypes, f as introspectedResourcesFulfilled, g as apiResourceFulfilled, t as typographiesFulfilled, h as registerComponentHandleEffect, j as mountComponentEffect, k as registerComponentEffect, l as registerReactComponentEffect } from "./actions.es.js";
44
44
  import { cache, cx } from "@emotion/css";
45
45
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
46
46
  import { T as Types, E as ElementID, B as Backgrounds, W as Width, h as ResponsiveIconRadioGroup, M as Margin, P as Padding, i as Border, j as BorderRadius, k as Shadows, G as GapY, l as GapX, m as ResponsiveSelect, n as ResponsiveNumber, o as Checkbox, p as Grid, q as TextInput, L as Link, r as ResponsiveColor, s as TextStyle, t as Images, N as Number$1, D as Date$1, F as Font, u as ResponsiveLength, v as TextArea, w as Table, x as TableFormFields, y as Image, z as ResponsiveOpacity, A as NavigationLinks, H as SocialLinks, J as RichText, V as Video, K as StyleControlProperty, O as ImageControlValueFormat, I as ImageControlType, C as ColorControlType, Q as BorderPropControllerFormat, U as ShadowsPropControllerFormat, X as BorderRadiusPropControllerFormat, Y as MarginPropControllerFormat, Z as PaddingPropControllerFormat, _ as WidthPropControllerFormat, S as SlotControlType, a as StyleControlType } from "./slot.es.js";
@@ -249,8 +249,6 @@ function getAPIResource$1(state, resourceType, resourceId) {
249
249
  }
250
250
  function reducer$1(state = getInitialState(), action) {
251
251
  switch (action.type) {
252
- case ActionTypes.RESTORE_API_RESOURCES_CACHE:
253
- return getInitialState(action.payload.serializedState);
254
252
  case ActionTypes.API_RESOURCE_FULFILLED: {
255
253
  const { resourceType, resourceId, resource } = action.payload;
256
254
  return new Map(state).set(resourceType, new Map(state.get(resourceType)).set(resourceId, resource));
@@ -626,9 +624,6 @@ class MakeswiftClient {
626
624
  KeyUtils.resetGenerator();
627
625
  return getSerializedState(this.makeswiftApiClient.getState());
628
626
  }
629
- updateCacheData(cacheData) {
630
- this.makeswiftApiClient.dispatch(restoreAPIResourcesCache(cacheData));
631
- }
632
627
  readSwatch(swatchId) {
633
628
  return getAPIResource(this.makeswiftApiClient.getState(), APIResourceType.Swatch, swatchId);
634
629
  }
@@ -1054,7 +1049,7 @@ class Document$1 extends NextDocument {
1054
1049
  });
1055
1050
  }
1056
1051
  }
1057
- const version = "0.5.2";
1052
+ const version = "0.5.3";
1058
1053
  function isErrorWithMessage(error) {
1059
1054
  return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
1060
1055
  }
@@ -1288,13 +1283,10 @@ async function getServerSideProps(ctx) {
1288
1283
  const Page = memo(({
1289
1284
  snapshot
1290
1285
  }) => {
1291
- const [client] = useState(() => new MakeswiftClient({
1286
+ const client = useMemo(() => new MakeswiftClient({
1292
1287
  uri: new URL("graphql", snapshot.apiOrigin).href,
1293
1288
  cacheData: snapshot.cacheData
1294
- }));
1295
- useEffect(() => {
1296
- client.updateCacheData(snapshot.cacheData);
1297
- }, [client, snapshot]);
1289
+ }), [snapshot]);
1298
1290
  return /* @__PURE__ */ jsx(RuntimeProvider, {
1299
1291
  client,
1300
1292
  rootElements: /* @__PURE__ */ new Map([[snapshot.document.id, snapshot.document.data]]),