chore: Ensure user is not connected to document when clearing cache

This commit is contained in:
Tom Moor
2024-02-25 11:41:50 -05:00
parent d42a493d8b
commit 83c1c513bb
2 changed files with 7 additions and 4 deletions

View File

@@ -8,6 +8,8 @@ import env from "~/env";
import { client } from "~/utils/ApiClient"; import { client } from "~/utils/ApiClient";
import Logger from "~/utils/Logger"; import Logger from "~/utils/Logger";
import { deleteAllDatabases } from "~/utils/developer"; import { deleteAllDatabases } from "~/utils/developer";
import history from "~/utils/history";
import { homePath } from "~/utils/routeHelpers";
export const copyId = createAction({ export const copyId = createAction({
name: ({ t }) => t("Copy ID"), name: ({ t }) => t("Copy ID"),
@@ -75,13 +77,14 @@ export const copyId = createAction({
}); });
export const clearIndexedDB = createAction({ export const clearIndexedDB = createAction({
name: ({ t }) => t("Delete IndexedDB cache"), name: ({ t }) => t("Clear IndexedDB cache"),
icon: <TrashIcon />, icon: <TrashIcon />,
keywords: "cache clear database", keywords: "cache clear database",
section: DeveloperSection, section: DeveloperSection,
perform: async ({ t }) => { perform: async ({ t }) => {
history.push(homePath());
await deleteAllDatabases(); await deleteAllDatabases();
toast.message(t("IndexedDB cache deleted")); toast.success(t("IndexedDB cache cleared"));
}, },
}); });

View File

@@ -11,8 +11,8 @@
"Delete": "Delete", "Delete": "Delete",
"Delete collection": "Delete collection", "Delete collection": "Delete collection",
"Copy ID": "Copy ID", "Copy ID": "Copy ID",
"Delete IndexedDB cache": "Delete IndexedDB cache", "Clear IndexedDB cache": "Clear IndexedDB cache",
"IndexedDB cache deleted": "IndexedDB cache deleted", "IndexedDB cache cleared": "IndexedDB cache cleared",
"Toggle debug logging": "Toggle debug logging", "Toggle debug logging": "Toggle debug logging",
"Debug logging enabled": "Debug logging enabled", "Debug logging enabled": "Debug logging enabled",
"Debug logging disabled": "Debug logging disabled", "Debug logging disabled": "Debug logging disabled",