refactor: collections versioning, migration and types

This commit is contained in:
Andrew Bastin
2021-08-24 23:12:53 +05:30
parent d1b2539d67
commit 6e9f16d8f1
5 changed files with 415 additions and 58 deletions

View File

@@ -6,6 +6,8 @@ import {
graphqlCollections$,
setRESTCollections,
setGraphqlCollections,
translateToNewRESTCollection,
translateToNewGQLCollection,
} from "~/newstore/collections"
import { settingsStore } from "~/newstore/settings"
@@ -114,7 +116,11 @@ export function initCollections() {
// TODO: Wth is with collections[0]
if (collections.length > 0) {
setRESTCollections(collections[0].collection)
setRESTCollections(
(collections[0].collection ?? []).map(
translateToNewRESTCollection
)
)
}
loadedRESTCollections = true
@@ -138,7 +144,9 @@ export function initCollections() {
// TODO: Wth is with collections[0]
if (collections.length > 0) {
setGraphqlCollections(collections[0].collection)
setGraphqlCollections(
(collections[0].collection ?? []).map(translateToNewGQLCollection)
)
}
loadedGraphqlCollections = true