diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2024-11-02 11:07:12 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2024-11-20 22:22:29 -0500 |
| commit | 455ccc660ed438ad5c191d4d4021780f936d24d9 (patch) | |
| tree | 3f4dad97c2fc1f357d68d234e778a73598019a01 /packages/frontend/src/ui/deck | |
| parent | prevent the following feed from auto-selecting a user under the mobile UI (diff) | |
| download | sharkey-455ccc660ed438ad5c191d4d4021780f936d24d9.tar.gz sharkey-455ccc660ed438ad5c191d4d4021780f936d24d9.tar.bz2 sharkey-455ccc660ed438ad5c191d4d4021780f936d24d9.zip | |
allow deck column updates to be awaited
Diffstat (limited to 'packages/frontend/src/ui/deck')
| -rw-r--r-- | packages/frontend/src/ui/deck/deck-store.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/frontend/src/ui/deck/deck-store.ts b/packages/frontend/src/ui/deck/deck-store.ts index eb587554b9..e87331fb3b 100644 --- a/packages/frontend/src/ui/deck/deck-store.ts +++ b/packages/frontend/src/ui/deck/deck-store.ts @@ -112,8 +112,8 @@ export const loadDeck = async () => { }; // TODO: deckがloadされていない状態でsaveすると意図せず上書きが発生するので対策する -export const saveDeck = throttle(1000, () => { - misskeyApi('i/registry/set', { +export const saveDeck = throttle(1000, async () => { + await misskeyApi('i/registry/set', { scope: ['client', 'deck', 'profiles'], key: deckStore.state.profile, value: { @@ -313,7 +313,7 @@ export function updateColumnWidget(id: Column['id'], widgetId: string, widgetDat saveDeck(); } -export function updateColumn(id: Column['id'], column: Partial<Column>) { +export async function updateColumn<TColumn>(id: Column['id'], column: Partial<TColumn>) { const columns = deepClone(deckStore.state.columns); const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); const currentColumn = deepClone(deckStore.state.columns[columnIndex]); @@ -322,6 +322,8 @@ export function updateColumn(id: Column['id'], column: Partial<Column>) { currentColumn[k] = v; } columns[columnIndex] = currentColumn; - deckStore.set('columns', columns); - saveDeck(); + await Promise.all([ + deckStore.set('columns', columns), + saveDeck(), + ]); } |