Skip to content

Commit

Permalink
Deletes table when data context has been deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
eireland committed Mar 21, 2024
1 parent 5b5144c commit b478133
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hooks/useCodapState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const useCodapState = () => {
setSelectedDataSetName(name);
dataSetInfo = await getDataContext(name);
setSelectedDataSet(dataSetInfo?.values);
} else {
setSelectedDataSetName("");
setSelectedDataSet(null);
}
};

Expand Down Expand Up @@ -154,7 +157,7 @@ export const useCodapState = () => {

const handleSelectDataSet = (name: string) => {
const selected = dataSets.find((d) => d.title === name);
return selected && handleSetDataSet(selected.name);
return selected ? handleSetDataSet(selected.name) : handleSetDataSet("");
};

const getCollectionNameFromId = (id: number) => {
Expand Down

0 comments on commit b478133

Please sign in to comment.