Skip to content

Commit e6efe84

Browse files
shweta2101cyrossignol
authored andcommitted
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 1d09094 commit e6efe84

2 files changed

Lines changed: 15 additions & 3 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ async function getDatasetInfo(id: string | null) {
180180
181181
await nextTick();
182182
183-
workspaceTitle.value = record.metadata?.dataset_detail?.name ?? '';
184-
projectGroupId.value = record.project_group.tdei_project_group_id;
185-
tdeiRecordId.value = record.tdei_dataset_id;
183+
workspaceTitle.value = record.metadata?.dataset_detail?.name ?? ''
184+
projectGroupId.value = record.project_group?.tdei_project_group_id ?? null
185+
tdeiRecordId.value = record.tdei_dataset_id ?? null
186186
187187
initMap();
188188
}

0 commit comments

Comments
 (0)