Fix types
This commit is contained in:
parent
dd29dcedc8
commit
e00002757e
|
@ -11,7 +11,7 @@ interface BuilderViewV2Store {
|
||||||
|
|
||||||
interface DerivedViewV2Store extends BuilderViewV2Store {
|
interface DerivedViewV2Store extends BuilderViewV2Store {
|
||||||
list: ViewV2[]
|
list: ViewV2[]
|
||||||
selected: ViewV2
|
selected?: ViewV2
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ViewV2Store extends DerivedBudiStore<
|
export class ViewV2Store extends DerivedBudiStore<
|
||||||
|
@ -20,20 +20,23 @@ export class ViewV2Store extends DerivedBudiStore<
|
||||||
> {
|
> {
|
||||||
constructor() {
|
constructor() {
|
||||||
const makeDerivedStore = (store: Writable<BuilderViewV2Store>) => {
|
const makeDerivedStore = (store: Writable<BuilderViewV2Store>) => {
|
||||||
return derived([store, tables], ([$store, $tables]) => {
|
return derived(
|
||||||
let list: ViewV2[] = []
|
[store, tables],
|
||||||
$tables.list?.forEach(table => {
|
([$store, $tables]): DerivedViewV2Store => {
|
||||||
const views = Object.values(table?.views || {}).filter(
|
let list: ViewV2[] = []
|
||||||
helpers.views.isV2
|
$tables.list?.forEach(table => {
|
||||||
)
|
const views = Object.values(table?.views || {}).filter(
|
||||||
list = list.concat(views)
|
helpers.views.isV2
|
||||||
})
|
)
|
||||||
return {
|
list = list.concat(views)
|
||||||
...$store,
|
})
|
||||||
list,
|
return {
|
||||||
selected: list.find(view => view.id === $store.selectedViewId),
|
...$store,
|
||||||
|
list,
|
||||||
|
selected: list.find(view => view.id === $store.selectedViewId),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
super(
|
super(
|
||||||
|
|
Loading…
Reference in New Issue