kgabryje opened a new pull request #15090:
URL: https://github.com/apache/superset/pull/15090


   ### SUMMARY
   When user changed filter type from "Time range" to "Value", the filter 
crashed. The reason was that in Value filter we assumed that 
`filterState.value` is either an array or undefined. When we switched filter 
type from "Time range", `filterState.value` was actually a string, which caused 
a crash. This PR fixes it by using `ensureIsArray` function to ensure that 
`filterState.value` is an array (duh) and setting initial value to 
`defaultValue`, so that values from other filters don't propagate to Value 
filter.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before:
   
https://user-images.githubusercontent.com/15073128/121539232-c5f8db80-ca05-11eb-9c47-a35ace7124e8.mov
   After:
   
https://user-images.githubusercontent.com/15073128/121539403-f17bc600-ca05-11eb-949d-a1787379db4a.mov
   
   ### TESTING INSTRUCTIONS
   0. Set `DASHBOARD_NATIVE_FILTERS` feature flag to True
   1. Add a time range filter
   2. Change filter's type to Value
   3. Verify that filter didn't crash and it's initial value equals to filter's 
default value (or empty if default value is not specified)
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] 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
   
   CC: @junlincc @villebro 


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

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