Skip to content

Commit 6c29fef

Browse files
committed
Populate missing group name and null-safe IDs
ProjectGroupPicker: when a model ID is present but the group name is not cached, paginate through groups until the matching group is found and populate searchText, selectedGroupName, and nameModel so the UI shows the correct name. tdei.vue: make assignment of projectGroupId and tdeiRecordId null-safe by using optional chaining and null coalescing to avoid errors when nested fields are missing.
1 parent f26c0d7 commit 6c29fef

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

components/ProjectGroupPicker.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,18 @@ onMounted(async () => {
283283
} else if (model.value && nameModel.value) {
284284
// Group is beyond page 1 — use the cached name for display
285285
applyCachedName()
286+
} else if (model.value) {
287+
// model is set but name is unknown — paginate until the group is found
288+
while (hasMore.value) {
289+
await loadGroups()
290+
const found = projectGroups.value.find(pg => pg.id === model.value)
291+
if (found) {
292+
searchText.value = found.name
293+
selectedGroupName.value = found.name
294+
nameModel.value = found.name
295+
break
296+
}
297+
}
286298
} else if (!model.value) {
287299
const first = projectGroups.value[0]!
288300
model.value = first.id

pages/workspace/create/tdei.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ async function getDatasetInfo(id: string | null) {
198198
await nextTick()
199199
200200
workspaceTitle.value = record.metadata?.dataset_detail?.name ?? ''
201-
projectGroupId.value = record.project_group.tdei_project_group_id
202-
tdeiRecordId.value = record.tdei_dataset_id
201+
projectGroupId.value = record.project_group?.tdei_project_group_id ?? null
202+
tdeiRecordId.value = record.tdei_dataset_id ?? null
203203
204204
initMap()
205205
}

0 commit comments

Comments
 (0)