mistercrunch commented on code in PR #33392:
URL: https://github.com/apache/superset/pull/33392#discussion_r2294968091
##########
superset-frontend/src/explore/components/PropertiesModal/index.tsx:
##########
@@ -179,20 +179,15 @@ function PropertiesModal({
}
try {
- const res = await SupersetClient.put({
+ let res = await SupersetClient.put({
endpoint: `/api/v1/chart/${slice.slice_id}`,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
- // update the redux state
- const updatedChart = {
- ...payload,
- ...res.json.result,
- tags,
- id: slice.slice_id,
- owners: selectedOwners,
- };
- onSave(updatedChart);
+ res = await SupersetClient.get({
+ endpoint: `/api/v1/chart/${slice.slice_id}`,
+ });
+ onSave(res.json.result);
Review Comment:
Higher level solution I've been meaning to push forward: the superset client
should be dynamically generated from the openapi spec, and be fully typed. It
would mean that typescript would then be able to catch this kind of stuff at
compile time. Meaning as you change the openapi spec to return this consistent
schema across PUT/POST/GET, it would regenerate a fully typed client, and `tsc`
would tell you exactly which calls break. Fun project if someone wants to take
this on!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]