kgabryje opened a new pull request #17084: URL: https://github.com/apache/superset/pull/17084
### SUMMARY Fixes #17060. Due to a race condition, sometimes `hydrateDashboard` was dispatched after `setActiveTabs`. That caused an override of current active tabs by initial state, which is an empty array. That caused the native filters that are in scope of current tab to be considered as out of scope. This PR fixes that behaviour by ensuring that `hydrateDashboard` gets called first. Previously, we called it in `useEffect`, which resulted in calling the function in the NEXT render cycle, after the dashboard components are rendered (`setActiveTabs` is called in mount lifecycle event of the Tabs component). I replaced `useEffect` with an `if` condition based on whether the dashboard has already been hydrated or not (`useRef` was used to ensure that we call it only once). ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Before: see linked issue After: https://user-images.githubusercontent.com/15073128/137131275-2994e81e-870c-480f-be5f-7bcc5b1b46cd.mov ### TESTING INSTRUCTIONS 1. Open a dashboard with native filters 2. Verify that filters are showed as "in scope" 3. Go back to dashboard list 4. Go back to the dashboard and verify that native filters still show as they're supposed to ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: fixes #17060 - [ ] 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 CC @junlincc -- 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]
