Skip to content

Commit c701838

Browse files
committed
refitem
1 parent 7490846 commit c701838

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

app/components/Viewer/BreadCrumb.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
const model_id = computed(() => treeviewStore.model_id)
1515
16-
const metaDatas = computed(() => dataStore.getItem(model_id.value).value)
16+
const metaDatas = computed(() => dataStore.refItem(model_id.value).value)
1717
</script>
1818

1919
<template>

app/stores/data.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ const viewer_generic_schemas = viewer_schemas.opengeodeweb_viewer.generic
1515
export const useDataStore = defineStore("data", () => {
1616
const viewerStore = useViewerStore()
1717

18-
function getItem(id) {
18+
async function item(id) {
19+
if (!id) {
20+
return {}
21+
}
22+
return (await database.data.get(id)) || {}
23+
}
24+
25+
function refItem(id) {
1926
if (!id) {
2027
return ref({})
2128
}
@@ -182,7 +189,8 @@ export const useDataStore = defineStore("data", () => {
182189

183190
return {
184191
getAllItems,
185-
getItem,
192+
item,
193+
refItem,
186194
meshComponentType,
187195
formatedMeshComponents,
188196
registerObject,

app/stores/data_style.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
6161
}
6262
}
6363

64-
function applyAllStylesFromState() {
64+
async function applyAllStylesFromState() {
6565
const ids = Object.keys(dataStyleState.styles || {})
6666
const promises = []
6767
for (const id of ids) {
68-
const meta = dataStore.getItem(id).value
68+
const meta = await dataStore.item(id)
6969
const viewerType = meta?.viewer_type
7070
const style = dataStyleState.styles[id]
7171
if (style && viewerType === "mesh") {

internal/stores/data_style/model/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ export default function useModelStyle() {
171171
return Promise.all(promise_array)
172172
}
173173

174-
function setModelMeshComponentsDefaultStyle(id) {
175-
const item = dataStore.getItem(id)
176-
const { mesh_components } = item.value
174+
async function setModelMeshComponentsDefaultStyle(id) {
175+
const item = await dataStore.item(id)
176+
const { mesh_components } = item
177177
const promise_array = []
178178
if ("Corner" in mesh_components) {
179179
promise_array.push(modelCornersStyleStore.setModelCornersDefaultStyle(id))

0 commit comments

Comments
 (0)