villebro opened a new pull request, #19612: URL: https://github.com/apache/superset/pull/19612
### SUMMARY PR #19341 introduced a regression that caused the adhoc filter value selector to disappear if a multioperator (IN, NOT IN) was chosen and there were no options. It is typical for the options to be missing if the "populate autocomplete filters options" option has been disabled in the dataset properties. I believe the reason for the bug that #19341 attempted to address was due to only checking if a selected item was `typeof 'object'`. This is `true` for `null`, which caused the logic to assume the value was in fact a `LabeledValue` (=object with keys `value` and `label`). Here we introduce a typeguard to make the checking even more robust, and remove the logic that delays rendering of `SelectWithLabel`. I checked that the original issue that #19341 set out to fix still works after this change. However, *deselecting* a NULL value doesn't seem to work properly if there are other falsy values (for this we'll need to use `LabeledValue` and use a custom `key` as do make sure each entry is unique). However, I consider this a separate issue which should be addressed in the native filter, so will address that in a separate PR. ### AFTER Now the dropdown renders correctly: https://user-images.githubusercontent.com/33317356/162419361-9aa255f4-e5bb-41a9-8a5d-7a9032392e4c.mp4 ### BEFORE Previously the dropdown disappeared if there were no options: https://user-images.githubusercontent.com/33317356/162419451-b1a03df2-7263-4ed4-84f4-6b55226681b9.mp4 ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> ### TESTING INSTRUCTIONS 1. Disable "populate autocomplete filters options" in a dataset 2. Explore the dataset and add an adhoc filter 3. choose any column and choose the "IN" operator 4. see the dropdown disappear ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: closes #19592 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
