@orion-studios/payload-studio 0.6.0-beta.135 → 0.6.0-beta.137

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.
@@ -2878,6 +2878,12 @@ function GrapesPageEditor({
2878
2878
  historyRestoreActiveRef.current = true;
2879
2879
  restoreCustomHistoryEntry(customEntry, action === "undo" ? "before" : "after");
2880
2880
  if (action === "undo") {
2881
+ if (!customEntry.before && customEntry.after) {
2882
+ const removedComponent = customEntry.after.component;
2883
+ customUndoStackRef.current = customUndoStackRef.current.filter(
2884
+ (entry) => entry.before?.component !== removedComponent && entry.after?.component !== removedComponent
2885
+ );
2886
+ }
2881
2887
  customRedoStackRef.current.push(customEntry);
2882
2888
  } else {
2883
2889
  customUndoStackRef.current.push(customEntry);
@@ -3136,7 +3142,7 @@ function GrapesPageEditor({
3136
3142
  }, autosaveIntervalMs);
3137
3143
  });
3138
3144
  editor.on("orion:component-history", (entry) => {
3139
- if (!historyReadyRef.current) {
3145
+ if (!historyReadyRef.current || historyRestoreActiveRef.current) {
3140
3146
  return;
3141
3147
  }
3142
3148
  if (!entry || typeof entry !== "object" || !("component" in entry) || !("before" in entry) || !("after" in entry)) {
@@ -2754,6 +2754,12 @@ function GrapesPageEditor({
2754
2754
  historyRestoreActiveRef.current = true;
2755
2755
  restoreCustomHistoryEntry(customEntry, action === "undo" ? "before" : "after");
2756
2756
  if (action === "undo") {
2757
+ if (!customEntry.before && customEntry.after) {
2758
+ const removedComponent = customEntry.after.component;
2759
+ customUndoStackRef.current = customUndoStackRef.current.filter(
2760
+ (entry) => entry.before?.component !== removedComponent && entry.after?.component !== removedComponent
2761
+ );
2762
+ }
2757
2763
  customRedoStackRef.current.push(customEntry);
2758
2764
  } else {
2759
2765
  customUndoStackRef.current.push(customEntry);
@@ -3012,7 +3018,7 @@ function GrapesPageEditor({
3012
3018
  }, autosaveIntervalMs);
3013
3019
  });
3014
3020
  editor.on("orion:component-history", (entry) => {
3015
- if (!historyReadyRef.current) {
3021
+ if (!historyReadyRef.current || historyRestoreActiveRef.current) {
3016
3022
  return;
3017
3023
  }
3018
3024
  if (!entry || typeof entry !== "object" || !("component" in entry) || !("before" in entry) || !("after" in entry)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.135",
3
+ "version": "0.6.0-beta.137",
4
4
  "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",