Skip to content

Commit

Permalink
Use Vue.set/delete to update loading status
Browse files Browse the repository at this point in the history
This is to make it work with Vue2 in Vue3 we can get rid of this.
  • Loading branch information
davelopez committed Sep 20, 2023
1 parent e7fe050 commit f80cf2c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions client/src/stores/datasetStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ export const useDatasetStore = defineStore("datasetStore", () => {
});

async function fetchDataset(params: { id: string }) {
loadingDatasets.value[params.id] = true;
const dataset = await fetchDatasetDetails(params);
Vue.set(storedDatasets.value, dataset.id, dataset);
delete loadingDatasets.value[params.id];
return dataset;
Vue.set(loadingDatasets.value, params.id, true);
try {
const dataset = await fetchDatasetDetails(params);
Vue.set(storedDatasets.value, dataset.id, dataset);
return dataset;
} finally {
Vue.delete(loadingDatasets.value, params.id);
}
}

function saveDatasets(historyContentsPayload: HistoryContentItemBase[]) {
Expand Down

0 comments on commit f80cf2c

Please sign in to comment.