Skip to content

Commit

Permalink
fix: fix infinite spinner in Enum component when target dataset doesn…
Browse files Browse the repository at this point in the history
…'t exist
  • Loading branch information
esasova committed Sep 27, 2024
1 parent b636797 commit 203786e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/hooks/DynamicValuesHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,25 @@ export const useDynamicValues = (parameter, targetDatasetId) => {
const fetchDynamicValues = async () => {
if (!dynamicSourceConfig) return;
if (targetDatasetId == null) {
console.error(`No dataset id forwarded to the enum parameter, can't fetch enum values dynamically.`);
setDynamicValues(
t(
'genericcomponent.dynamicValues.noDataset',
"No dataset id forwarded to the parameter, can't fetch its value dynamically."
)
);
return;
}

const targetDataset = findDatasetById(targetDatasetId);
if (!targetDataset) {
setDynamicValues(
t(
'genericcomponent.dynamicValues.notExistingDataset',
"Can't retrieve dynamic values: dataset doesn't exist."
)
);
return;
}
if (!isUnmounted.current && targetDataset.ingestionStatus !== INGESTION_STATUS.SUCCESS) {
setDynamicValues(
`Can't retrieve dynamic values: dataset is not ready (ingestionStatus is "${targetDataset.ingestionStatus}")`
Expand Down

0 comments on commit 203786e

Please sign in to comment.