Skip to content

Commit f5ebd9c

Browse files
shweta2101cyrossignol
authored andcommitted
Clear record before merging dataset info
When loading dataset info in getDatasetInfo, clear any existing keys on the shared record object before Object.assign. This prevents stale/orphaned fields from a previously loaded dataset from persisting when switching datasets.
1 parent 8214374 commit f5ebd9c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pages/workspace/create/tdei.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ async function getDatasetInfo(id: string | null) {
168168
const info = await client.getDatasetInfo(id);
169169
170170
if (!info) return
171+
172+
// Clear stale keys from any previously loaded dataset before merging,
173+
// so switching datasets never leaves orphaned fields in record.
174+
for (const key of Object.keys(record)) {
175+
delete record[key]
176+
}
177+
171178
Object.assign(record, info)
172179
});
173180

0 commit comments

Comments
 (0)