@firecms/core 3.0.0-canary.284 → 3.0.0-canary.286

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
@@ -9756,27 +9756,6 @@ function customReviver(key, value) {
9756
9756
  }
9757
9757
  return value;
9758
9758
  }
9759
- if (isLocalStorageAvailable) {
9760
- try {
9761
- for (let i = 0; i < localStorage.length; i++) {
9762
- const fullKey = localStorage.key(i);
9763
- if (fullKey && fullKey.startsWith(LOCAL_STORAGE_PREFIX)) {
9764
- const path = fullKey.substring(LOCAL_STORAGE_PREFIX.length);
9765
- const entityString = localStorage.getItem(fullKey);
9766
- if (entityString) {
9767
- try {
9768
- const entity = JSON.parse(entityString, customReviver);
9769
- entityCache.set(path, entity);
9770
- } catch (parseError) {
9771
- console.error(`Failed to parse entity for path "${path}" from localStorage:`, parseError);
9772
- }
9773
- }
9774
- }
9775
- }
9776
- } catch (error) {
9777
- console.error("Error accessing localStorage during initialization:", error);
9778
- }
9779
- }
9780
9759
  function saveEntityToCache(path, data) {
9781
9760
  entityCache.set(path, data);
9782
9761
  if (isLocalStorageAvailable) {
@@ -9789,11 +9768,11 @@ function saveEntityToCache(path, data) {
9789
9768
  }
9790
9769
  }
9791
9770
  }
9792
- function getEntityFromCache(path) {
9771
+ function getEntityFromCache(path, useLocalStorage = true) {
9793
9772
  if (entityCache.has(path)) {
9794
9773
  return entityCache.get(path);
9795
9774
  }
9796
- if (isLocalStorageAvailable) {
9775
+ if (isLocalStorageAvailable && useLocalStorage) {
9797
9776
  try {
9798
9777
  const key = LOCAL_STORAGE_PREFIX + path;
9799
9778
  const entityString = localStorage.getItem(key);
@@ -9850,7 +9829,8 @@ const EntityCollectionRowActions = function EntityCollectionRowActions2({
9850
9829
  const hasCollapsedActions = actions.some((a) => a.collapsed || a.collapsed === void 0);
9851
9830
  const collapsedActions = actions.filter((a_0) => a_0.collapsed || a_0.collapsed === void 0);
9852
9831
  const uncollapsedActions = actions.filter((a_1) => a_1.collapsed === false);
9853
- const hasDraft = hasEntityInCache(fullPath + "/" + entity.id);
9832
+ const enableLocalChangesBackup = collection?.enableLocalChangesBackup !== void 0 ? collection?.enableLocalChangesBackup : true;
9833
+ const hasDraft = enableLocalChangesBackup ? hasEntityInCache(fullPath + "/" + entity.id) : false;
9854
9834
  return /* @__PURE__ */ jsxs("div", { className: cls("h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 dark:bg-opacity-90 z-10", frozen ? "sticky left-0" : ""), onClick: useCallback((event) => {
9855
9835
  event.stopPropagation();
9856
9836
  }, []), style: {
@@ -23181,7 +23161,7 @@ function EntityEditView({
23181
23161
  useCache: false
23182
23162
  });
23183
23163
  const enableLocalChangesBackup = props.collection.enableLocalChangesBackup !== void 0 ? props.collection.enableLocalChangesBackup : true;
23184
- const initialDirtyValues = enableLocalChangesBackup ? entityId ? getEntityFromCache(props.path + "/" + entityId) : getEntityFromCache(props.path + "#new") : void 0;
23164
+ const initialDirtyValues = entityId ? getEntityFromCache(props.path + "/" + entityId, enableLocalChangesBackup) : getEntityFromCache(props.path + "#new", enableLocalChangesBackup);
23185
23165
  const authController = useAuthController();
23186
23166
  const initialStatus = props.copy ? "copy" : entityId ? "existing" : "new";
23187
23167
  const [status, setStatus] = useState(initialStatus);