fix(shortcuts): make writable copies of saved shortcuts from storageApi

Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
Phil Kuang
2021-12-23 20:11:09 -05:00
parent 5284458e18
commit b50cbd047b
2 changed files with 8 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-shortcuts': patch
---
Properly read saved shortcuts from StorageApi
@@ -82,11 +82,9 @@ export class LocalStoredShortcuts implements ShortcutApi {
};
private get() {
return (
(this.storageApi.get('items') as Shortcut[])?.sort((a, b) =>
a.title >= b.title ? 1 : -1,
) ?? []
);
return Array.from(
this.storageApi.snapshot<Shortcut[]>('items').value ?? [],
).sort((a, b) => (a.title >= b.title ? 1 : -1));
}
private notify() {