korbit-ai[bot] commented on code in PR #31979:
URL: https://github.com/apache/superset/pull/31979#discussion_r1932429945


##########
superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx:
##########
@@ -52,13 +54,13 @@ export const validatedInputField = ({
     id={field}
     name={field}
     required={required}
-    value={db?.parameters?.[field]}
+    value={db?.parameters?.[field as keyof DatabaseParameters]}
     validationMethods={{ onBlur: getValidation }}
     errorMessage={validationErrors?.[field]}
-    placeholder={FIELD_TEXT_MAP[field].placeholder}
-    helpText={FIELD_TEXT_MAP[field].helpText}
-    label={FIELD_TEXT_MAP[field].label || field}
+    placeholder={FIELD_TEXT_MAP[field as FieldTextMapKey].placeholder}
+    helpText={FIELD_TEXT_MAP[field as 'account']?.helpText}
+    label={FIELD_TEXT_MAP[field as FieldTextMapKey].label || field}
     onChange={changeMethods.onParametersChange}
-    className={FIELD_TEXT_MAP[field].className || field}
+    className={FIELD_TEXT_MAP[field as 'warehouse' | 'role'].className || 
field}

Review Comment:
   @hainenber I see the issue you're experiencing with the proposed change. My 
original intention was to suggest a solution that might help to reduce 
potential issues with missing styles for potential future field types. But, 
considering that you're currently only dealing with 'warehouse' and 'role' 
fields, your code should work fine as is. Thank you for your attentive response 
and for considering my feedback.



-- 
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]

Reply via email to