rusackas commented on code in PR #37919:
URL: https://github.com/apache/superset/pull/37919#discussion_r3565176729
##########
superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx:
##########
@@ -220,6 +234,7 @@ export const EncryptedField = ({
},
});
setFileList(info.fileList);
+ getValidation();
Review Comment:
Confirmed real and applied (09731b28ce). Traced it: `getValidation`
(`getBlurValidation` in `DatabaseModal/index.tsx`) is a `useCallback` closing
over `db` as of the last render; `onParametersChange` only dispatches a
`useReducer` action, so calling `getValidation()` synchronously right after it
validates the *previous* render's `db`, not the just-uploaded credential. Fixed
by deferring the call to a `useEffect` that fires once
`db.parameters[encryptedField]` actually reflects the uploaded content. Added a
regression test that asserts `getValidation` is not called before the parent
re-renders with the committed value, and is called exactly once after — it
fails against the pre-fix code (verified locally by stashing the fix).
##########
superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.test.tsx:
##########
@@ -373,6 +373,39 @@ describe('EncryptedField', () => {
});
});
+ // eslint-disable-next-line no-restricted-globals -- TODO: Migrate from
describe blocks
+ describe('renderAsTextArea branch', () => {
Review Comment:
Applied — flattened the 3 tests into top-level `test()` cases with a shared
name prefix instead of a new `describe()` wrapper (09731b28ce), per the repo's
existing convention in this same file (see the `eslint-disable-next-line
no-restricted-globals -- TODO: Migrate from describe blocks` markers on the
pre-existing blocks).
--
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]