codeant-ai-for-open-source[bot] commented on code in PR #42592:
URL: https://github.com/apache/superset/pull/42592#discussion_r3739990994
##########
superset-frontend/src/features/roles/RoleFormItems.tsx:
##########
@@ -60,6 +60,13 @@ export const PermissionsField = ({
placeholder={t('Select permissions')}
options={options}
loading={loading}
+ // fetchPermissionOptions already filters server-side against the raw
+ // permission/view_menu names. AsyncSelect's default client-side
+ // re-filter checks the search term against the rendered label, but
+ // that label has had underscores replaced with spaces
+ // (formatPermissionLabel), so a raw-name search term never matches
+ // it and the correctly-fetched option gets hidden. See #42041.
+ filterOption={false}
Review Comment:
Yes—an underscore-normalizing `filterOption` is a better fit here. It
preserves client-side narrowing of the already-loaded options while allowing a
raw search such as `stg_silver` to match the displayed label `stg silver`.
For example:
```tsx
filterOption={(input, option) => {
const normalize = (value: string) =>
value.toLowerCase().replace(/_/g, ' ');
return normalize(String(option?.label ?? '')).includes(normalize(input));
}}
```
This should replace `filterOption={false}` on `PermissionsField`. It
addresses the first-search edit-flow case by filtering the injected permissions
instead of leaving them all visible.
One separate concern remains: if `AsyncSelect` marks all values as loaded
and therefore skips the loader entirely, no client-side predicate can expose
permissions absent from the cached options. The permission loader should still
be invoked for non-empty searches, or the “all values loaded” short-circuit
should not apply to this field. Assuming the server request is made, the
normalized predicate closes both issues without disabling useful client-side
filtering.
--
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]