diff --git a/plugins/shortcuts/src/EditShortcut.test.tsx b/plugins/shortcuts/src/EditShortcut.test.tsx index bf2396e194..20ef433c37 100644 --- a/plugins/shortcuts/src/EditShortcut.test.tsx +++ b/plugins/shortcuts/src/EditShortcut.test.tsx @@ -86,11 +86,7 @@ describe('EditShortcut', () => { fireEvent.click(screen.getByText('Remove')); await waitFor(() => { - expect(spy).toBeCalledWith({ - id: 'id', - title: 'some title', - url: '/some-url', - }); + expect(spy).toBeCalledWith('id'); }); }); diff --git a/plugins/shortcuts/src/EditShortcut.tsx b/plugins/shortcuts/src/EditShortcut.tsx index 8b98406703..efe8726992 100644 --- a/plugins/shortcuts/src/EditShortcut.tsx +++ b/plugins/shortcuts/src/EditShortcut.tsx @@ -78,7 +78,7 @@ export const EditShortcut = ({ shortcut, onClose, anchorEl, api }: Props) => { const handleRemove = async () => { try { - await api.remove(shortcut); + await api.remove(shortcut.id); alertApi.post({ message: `Removed shortcut '${shortcut.title}' from your sidebar`, severity: 'success', diff --git a/plugins/shortcuts/src/api/LocalStoredShortcuts.ts b/plugins/shortcuts/src/api/LocalStoredShortcuts.ts index 377f8e9190..ee8735edb4 100644 --- a/plugins/shortcuts/src/api/LocalStoredShortcuts.ts +++ b/plugins/shortcuts/src/api/LocalStoredShortcuts.ts @@ -39,8 +39,8 @@ export class LocalStoredShortcuts implements ShortcutApi { this.notify(); } - async remove(shortcut: Shortcut) { - const shortcuts = this.get().filter(s => s.id !== shortcut.id); + async remove(id: string) { + const shortcuts = this.get().filter(s => s.id !== id); await this.storageApi.set('items', shortcuts); this.notify(); diff --git a/plugins/shortcuts/src/api/ShortcutApi.ts b/plugins/shortcuts/src/api/ShortcutApi.ts index 826988d01f..74b6aaf777 100644 --- a/plugins/shortcuts/src/api/ShortcutApi.ts +++ b/plugins/shortcuts/src/api/ShortcutApi.ts @@ -36,7 +36,7 @@ export interface ShortcutApi { /** * Removes the shortcut. */ - remove(shortcut: Shortcut): Promise; + remove(id: string): Promise; /** * Finds an existing shortcut that matches the ID of the