eschutho commented on code in PR #21523:
URL: https://github.com/apache/superset/pull/21523#discussion_r996110493
##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx:
##########
@@ -271,26 +276,44 @@ function dbReducer(
[action.payload.name]: action.payload.value,
};
case ActionType.parametersChange:
- if (
- trimmedState.catalog !== undefined &&
- action.payload.type?.startsWith('catalog')
- ) {
- // Formatting wrapping google sheets table catalog
- const idx = action.payload.type?.split('-')[1];
- const catalogToUpdate = trimmedState?.catalog[idx] || {};
- catalogToUpdate[action.payload.name] = action.payload.value;
-
- const paramatersCatalog = {};
- // eslint-disable-next-line array-callback-return
- trimmedState.catalog?.map((item: CatalogObject) => {
- paramatersCatalog[item.name] = item.value;
- });
-
+ if (action.payload.type?.startsWith('catalog')) {
Review Comment:
Thanks for calling that out. I had originally written logic for the case
where `action.payload.type?.startsWith('catalog') && trimmedState.catalog ===
undefined`, thus the nested logic, but now I see that a form with a catalog
will always have a defined catalog state, so I removed the logic and added some
comments.
--
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]