Skip to content

Commit

Permalink
fix: support old drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
maybeanerd committed Apr 7, 2024
1 parent a9bdf59 commit 2820e95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion composables/masto/statusDrafts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ export function useDraft(
get() {
if (!currentUserDrafts.value[draftKey])
currentUserDrafts.value[draftKey] = [initial()]
return currentUserDrafts.value[draftKey]
const drafts = currentUserDrafts.value[draftKey]
if (Array.isArray(drafts))
return drafts
return [drafts]
},
set(val) {
currentUserDrafts.value[draftKey] = val
Expand Down
4 changes: 3 additions & 1 deletion types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export interface DraftItem {
mentions?: string[]
}

export type DraftMap = Record<string, Array<DraftItem>>
export type DraftMap = Record<string, Array<DraftItem>
// For backward compatibility we need to support single draft items
| DraftItem>

export interface ConfirmDialogOptions {
title: string
Expand Down

0 comments on commit 2820e95

Please sign in to comment.