Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Only response to CODAP data changes in dataset mode [PT-187361590] #45

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/hooks/use-codap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@

const handleDataChanged = useCallback(async ({datasetName, collectionName, attributeName}: CODAPAttribute) => {
const values = await getValuesForAttribute(datasetName, collectionName, attributeName);
onCODAPDataChanged(values);
}, [onCODAPDataChanged]);
if (viewMode === "dataset") {
onCODAPDataChanged(values);
}
}, [onCODAPDataChanged, viewMode]);

const setPluginState = useCallback((values: any) => {
setLoadState("loaded");
Expand Down Expand Up @@ -143,7 +145,7 @@
"action": "get",
"resource": "dataContextList"
}).catch((reason) => {
console.log("unable to get data context list because " + reason);

Check warning on line 148 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected console statement

Check warning on line 148 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / S3 Deploy

Unexpected console statement
});
if (tListResult?.success) {
tFoundValue = tListResult.values.find((iValue: any) => {
Expand Down Expand Up @@ -174,10 +176,10 @@
]
}
}).catch((reason) => {
console.log("unable to create output dataset because " + reason);

Check warning on line 179 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected console statement

Check warning on line 179 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / S3 Deploy

Unexpected console statement
});
if (!(tCreateResult?.success)) {
console.log("unable to create output dataset");

Check warning on line 182 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected console statement

Check warning on line 182 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / S3 Deploy

Unexpected console statement
return;
}
// setOutputDatasetID(tCreateResult.values.id);
Expand All @@ -189,7 +191,7 @@
"action": "get",
"resource": "componentList"
}).catch((reason) => {
console.log("unable to get component list because " + reason);

Check warning on line 194 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected console statement

Check warning on line 194 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / S3 Deploy

Unexpected console statement
});
if (tListResult?.success) {
tFoundValue = tListResult.values.find((iValue: any) => {
Expand All @@ -208,10 +210,10 @@
position: "top"
}
}).catch((reason) => {
console.log("unable to create case table because " + reason);

Check warning on line 213 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected console statement

Check warning on line 213 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / S3 Deploy

Unexpected console statement
});
if (!(tCreateResult?.success)) {
console.log("unable to create case table");

Check warning on line 216 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected console statement

Check warning on line 216 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / S3 Deploy

Unexpected console statement
}
}
}, []);
Expand All @@ -229,7 +231,7 @@
resource: `dataContext[${OutputDatasetName}].item`,
values: requests
}).catch((reason) => {
console.log("unable to create items because " + reason);

Check warning on line 234 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected console statement

Check warning on line 234 in src/hooks/use-codap.ts

View workflow job for this annotation

GitHub Actions / S3 Deploy

Unexpected console statement
});

incrementSequenceNumber();
Expand Down
Loading