Skip to content

Commit

Permalink
fix: handle layers is not array after restore
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Feb 5, 2024
1 parent c32f785 commit c996512
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/app-frontend/src/features/timeline/composable/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ export function layerFactory(options: LayerFromBackend): Layer {

export function getLayers(appId: string) {
let layers = layersPerApp.value[appId]
if (!layers) {
layers = []
layersPerApp.value[appId] = layers
if (!layers || !Array.isArray(layers)) {
layersPerApp.value[appId] = []
layers = layersPerApp.value[appId]
}
return layers
}

function getHiddenLayers(appId: string) {
let layers = hiddenLayersPerApp.value[appId]
if (!layers) {
layers = []
hiddenLayersPerApp.value[appId] = layers
if (!layers || !Array.isArray(layers)) {
hiddenLayersPerApp.value[appId] = []
layers = hiddenLayersPerApp.value[appId]
}
return layers
Expand Down

0 comments on commit c996512

Please sign in to comment.