@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.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);
|
|
@@ -23181,7 +23160,7 @@ function EntityEditView({
|
|
|
23181
23160
|
useCache: false
|
|
23182
23161
|
});
|
|
23183
23162
|
const enableLocalChangesBackup = props.collection.enableLocalChangesBackup !== void 0 ? props.collection.enableLocalChangesBackup : true;
|
|
23184
|
-
const initialDirtyValues =
|
|
23163
|
+
const initialDirtyValues = entityId ? getEntityFromCache(props.path + "/" + entityId, enableLocalChangesBackup) : getEntityFromCache(props.path + "#new", enableLocalChangesBackup);
|
|
23185
23164
|
const authController = useAuthController();
|
|
23186
23165
|
const initialStatus = props.copy ? "copy" : entityId ? "existing" : "new";
|
|
23187
23166
|
const [status, setStatus] = useState(initialStatus);
|