@firecms/core 3.0.0-canary.284 → 3.0.0-canary.285
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 +3 -24
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -24
- package/dist/index.umd.js.map +1 -1
- package/dist/util/entity_cache.d.ts +2 -1
- package/package.json +5 -5
- package/src/core/EntityEditView.tsx +3 -5
- package/src/util/entity_cache.ts +22 -33
package/dist/index.umd.js
CHANGED
|
@@ -9754,27 +9754,6 @@
|
|
|
9754
9754
|
}
|
|
9755
9755
|
return value;
|
|
9756
9756
|
}
|
|
9757
|
-
if (isLocalStorageAvailable) {
|
|
9758
|
-
try {
|
|
9759
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
9760
|
-
const fullKey = localStorage.key(i);
|
|
9761
|
-
if (fullKey && fullKey.startsWith(LOCAL_STORAGE_PREFIX)) {
|
|
9762
|
-
const path = fullKey.substring(LOCAL_STORAGE_PREFIX.length);
|
|
9763
|
-
const entityString = localStorage.getItem(fullKey);
|
|
9764
|
-
if (entityString) {
|
|
9765
|
-
try {
|
|
9766
|
-
const entity = JSON.parse(entityString, customReviver);
|
|
9767
|
-
entityCache.set(path, entity);
|
|
9768
|
-
} catch (parseError) {
|
|
9769
|
-
console.error(`Failed to parse entity for path "${path}" from localStorage:`, parseError);
|
|
9770
|
-
}
|
|
9771
|
-
}
|
|
9772
|
-
}
|
|
9773
|
-
}
|
|
9774
|
-
} catch (error) {
|
|
9775
|
-
console.error("Error accessing localStorage during initialization:", error);
|
|
9776
|
-
}
|
|
9777
|
-
}
|
|
9778
9757
|
function saveEntityToCache(path, data) {
|
|
9779
9758
|
entityCache.set(path, data);
|
|
9780
9759
|
if (isLocalStorageAvailable) {
|
|
@@ -9787,11 +9766,11 @@
|
|
|
9787
9766
|
}
|
|
9788
9767
|
}
|
|
9789
9768
|
}
|
|
9790
|
-
function getEntityFromCache(path) {
|
|
9769
|
+
function getEntityFromCache(path, useLocalStorage = true) {
|
|
9791
9770
|
if (entityCache.has(path)) {
|
|
9792
9771
|
return entityCache.get(path);
|
|
9793
9772
|
}
|
|
9794
|
-
if (isLocalStorageAvailable) {
|
|
9773
|
+
if (isLocalStorageAvailable && useLocalStorage) {
|
|
9795
9774
|
try {
|
|
9796
9775
|
const key = LOCAL_STORAGE_PREFIX + path;
|
|
9797
9776
|
const entityString = localStorage.getItem(key);
|
|
@@ -23179,7 +23158,7 @@
|
|
|
23179
23158
|
useCache: false
|
|
23180
23159
|
});
|
|
23181
23160
|
const enableLocalChangesBackup = props.collection.enableLocalChangesBackup !== void 0 ? props.collection.enableLocalChangesBackup : true;
|
|
23182
|
-
const initialDirtyValues =
|
|
23161
|
+
const initialDirtyValues = entityId ? getEntityFromCache(props.path + "/" + entityId, enableLocalChangesBackup) : getEntityFromCache(props.path + "#new", enableLocalChangesBackup);
|
|
23183
23162
|
const authController = useAuthController();
|
|
23184
23163
|
const initialStatus = props.copy ? "copy" : entityId ? "existing" : "new";
|
|
23185
23164
|
const [status, setStatus] = React.useState(initialStatus);
|