fix storage hook
This commit is contained in:
@@ -21,7 +21,7 @@ export function useSyncCaches() {
|
|||||||
|
|
||||||
const updateDataCache = useCallback(
|
const updateDataCache = useCallback(
|
||||||
async (url) => {
|
async (url) => {
|
||||||
const dataCaches = sync.dataCaches || {};
|
const dataCaches = sync?.dataCaches || {};
|
||||||
dataCaches[url] = Date.now();
|
dataCaches[url] = Date.now();
|
||||||
await updateSync({ dataCaches });
|
await updateSync({ dataCaches });
|
||||||
},
|
},
|
||||||
@@ -30,7 +30,7 @@ export function useSyncCaches() {
|
|||||||
|
|
||||||
const deleteDataCache = useCallback(
|
const deleteDataCache = useCallback(
|
||||||
async (url) => {
|
async (url) => {
|
||||||
const dataCaches = sync.dataCaches || {};
|
const dataCaches = sync?.dataCaches || {};
|
||||||
delete dataCaches[url];
|
delete dataCaches[url];
|
||||||
await updateSync({ dataCaches });
|
await updateSync({ dataCaches });
|
||||||
},
|
},
|
||||||
@@ -38,7 +38,7 @@ export function useSyncCaches() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dataCaches: sync.dataCaches || {},
|
dataCaches: sync?.dataCaches || {},
|
||||||
updateDataCache,
|
updateDataCache,
|
||||||
deleteDataCache,
|
deleteDataCache,
|
||||||
reloadSync,
|
reloadSync,
|
||||||
|
|||||||
Reference in New Issue
Block a user