@thoughtbot/superglue 2.0.0-alpha.8 → 2.0.0-alpha.9

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.
@@ -6338,7 +6338,12 @@ the same page. Or if you're sure you want to proceed, use force: true.
6338
6338
  throw new MismatchedComponentError(message);
6339
6339
  }
6340
6340
  }
6341
- dispatch(receiveResponse({ pageKey, response: json }));
6341
+ dispatch(
6342
+ receiveResponse({
6343
+ pageKey,
6344
+ response: JSON.parse(JSON.stringify(json))
6345
+ })
6346
+ );
6342
6347
  const existingPage = createProxy(
6343
6348
  pages[pageKey],
6344
6349
  { current: fragments },
@@ -6576,7 +6581,7 @@ function saveAndProcessPage(pageKey, page) {
6576
6581
  JSON.stringify(addPlaceholdersToDeferredNodes(existingPage, nextPage))
6577
6582
  );
6578
6583
  }
6579
- page.fragments.reverse().forEach((fragment) => {
6584
+ page.fragments.slice().reverse().forEach((fragment) => {
6580
6585
  const { id, path } = fragment;
6581
6586
  const node = getIn(nextPage, path);
6582
6587
  nextPage = setIn(nextPage, path, { __id: id });
@@ -6674,6 +6679,8 @@ function unproxy2(proxy) {
6674
6679
  // lib/hooks/useSetFragment.tsx
6675
6680
  var import_react_redux2 = require("react-redux");
6676
6681
  var import_immer = require("immer");
6682
+ var immer = new import_immer.Immer();
6683
+ immer.setAutoFreeze(false);
6677
6684
  function useSetFragment() {
6678
6685
  const dispatch = (0, import_react_redux2.useDispatch)();
6679
6686
  const fragments = (0, import_react_redux2.useSelector)((state) => state.fragments);
@@ -6683,7 +6690,7 @@ function useSetFragment() {
6683
6690
  if (currentFragment === void 0) {
6684
6691
  throw new Error(`Fragment with id "${fragmentId}" not found`);
6685
6692
  }
6686
- const updatedFragment = (0, import_immer.produce)(currentFragment, updater);
6693
+ const updatedFragment = immer.produce(currentFragment, updater);
6687
6694
  dispatch(
6688
6695
  saveFragment({
6689
6696
  fragmentId,