Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamlangford committed Jun 20, 2024
1 parent e451b05 commit a17b380
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/background/removeExtensionForEveryTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import {
removeInstalledExtension,
removeSidebars,
clearDraftElements,
clearDraftModComponents,
} from "@/contentScript/messenger/api";
import { forEachTab } from "@/utils/extensionUtils";
import { type UUID } from "@/types/stringTypes";
Expand All @@ -34,7 +34,7 @@ export async function removeExtensionForEveryTab(
await forEachTab(async ({ tabId }) => {
const allFrames = { tabId, frameId: "allFrames" } as const;
removeInstalledExtension(allFrames, extensionId);
clearDraftElements(allFrames, { uuid: extensionId });
clearDraftModComponents(allFrames, { uuid: extensionId });
await removeSidebars({ tabId }, [extensionId]);
});
await uninstallContextMenu({ extensionId });
Expand Down
4 changes: 3 additions & 1 deletion src/contentScript/messenger/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ export const getInstalledExtensionPoints = getMethod(
);
export const resetTab = getNotifier("RESET_TAB");
export const toggleQuickBar = getMethod("TOGGLE_QUICK_BAR");
export const clearDraftElements = getNotifier("CLEAR_DRAFT_ELEMENTS");
export const clearDraftModComponents = getNotifier(
"CLEAR_DRAFT_MOD_COMPONENTS",
);
export const updateDraftElement = getNotifier("UPDATE_DRAFT_ELEMENT");
export const checkAvailable = getMethod("CHECK_AVAILABLE");
4 changes: 2 additions & 2 deletions src/contentScript/messenger/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ declare global {
INSTALLED_EXTENSION_POINTS: typeof getActiveExtensionPoints;
ENSURE_EXTENSION_POINTS_INSTALLED: typeof ensureInstalled;
RESET_TAB: typeof resetTab;
CLEAR_DRAFT_ELEMENTS: typeof clearDraftModComponents;
CLEAR_DRAFT_MOD_COMPONENTS: typeof clearDraftModComponents;
UPDATE_DRAFT_ELEMENT: typeof updateDraftModComponent;
}
}
Expand Down Expand Up @@ -179,7 +179,7 @@ export default function registerMessenger(): void {
INSTALLED_EXTENSION_POINTS: getActiveExtensionPoints,
ENSURE_EXTENSION_POINTS_INSTALLED: ensureInstalled,
RESET_TAB: resetTab,
CLEAR_DRAFT_ELEMENTS: clearDraftModComponents,
CLEAR_DRAFT_MOD_COMPONENTS: clearDraftModComponents,
UPDATE_DRAFT_ELEMENT: updateDraftModComponent,
});
}
4 changes: 2 additions & 2 deletions src/pageEditor/hooks/useRemoveModComponentFromStorage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { removeExtensionsFromAllTabs } from "@/store/uninstallUtils";
import { useRemoveModComponentFromStorage } from "./useRemoveModComponentFromStorage";
import { actions as editorActions } from "@/pageEditor/slices/editorSlice";
import { actions as extensionsActions } from "@/store/extensionsSlice";
import { clearDraftElements } from "@/contentScript/messenger/api";
import { clearDraftModComponents } from "@/contentScript/messenger/api";

import { uuidSequence } from "@/testUtils/factories/stringFactories";

Expand Down Expand Up @@ -52,7 +52,7 @@ test("useRemoveModComponentFromStorage", async () => {
expect(dispatch).toHaveBeenCalledWith(
extensionsActions.removeExtension({ extensionId }),
);
expect(clearDraftElements).toHaveBeenCalledWith(expect.any(Object), {
expect(clearDraftModComponents).toHaveBeenCalledWith(expect.any(Object), {
uuid: extensionId,
});
expect(removeExtensionsFromAllTabs).toHaveBeenCalledWith([extensionId]);
Expand Down
4 changes: 2 additions & 2 deletions src/pageEditor/hooks/useRemoveModComponentFromStorage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { Events } from "@/telemetry/events";
import notify from "@/utils/notify";
import { actions as editorActions } from "@/pageEditor/slices/editorSlice";
import { actions as extensionsActions } from "@/store/extensionsSlice";
import { clearDraftElements } from "@/contentScript/messenger/api";
import { clearDraftModComponents } from "@/contentScript/messenger/api";
import { removeExtensionsFromAllTabs } from "@/store/uninstallUtils";
import { allFramesInInspectedTab } from "@/pageEditor/context/connection";

Expand Down Expand Up @@ -107,7 +107,7 @@ export function useRemoveModComponentFromStorage(): (

// Remove from the host page
try {
clearDraftElements(allFramesInInspectedTab, {
clearDraftModComponents(allFramesInInspectedTab, {
uuid: extensionId,
});
} catch (error) {
Expand Down

0 comments on commit a17b380

Please sign in to comment.