-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dashboard): race condition between hydrating dashboard and set active tabs #17084
Conversation
@@ -141,7 +141,12 @@ export function initEnhancer( | |||
const composeEnhancers = | |||
process.env.WEBPACK_MODE === 'development' | |||
? /* eslint-disable-next-line no-underscore-dangle, dot-notation */ | |||
window['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'] || compose | |||
window['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not directly related to the fixed bug, but this will allow us to trace which component dispatched an action from the redux inspector tool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the added test 👍
/testenv up |
@kgabryje Ephemeral environment spinning up at http://34.221.203.193:8080. Credentials are |
Codecov Report
@@ Coverage Diff @@
## master #17084 +/- ##
==========================================
- Coverage 76.94% 76.89% -0.05%
==========================================
Files 1030 1031 +1
Lines 55088 55190 +102
Branches 7480 7504 +24
==========================================
+ Hits 42385 42437 +52
- Misses 12452 12503 +51
+ Partials 251 250 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Ephemeral environment shutdown and build artifacts deleted. |
…tive tabs (apache#17084) * fix(dashboard): race condition between hydrating dashboard and set active tabs * Fix linting * Change variable name (cherry picked from commit 3ad7483)
…tive tabs (apache#17084) * fix(dashboard): race condition between hydrating dashboard and set active tabs * Fix linting * Change variable name
SUMMARY
Fixes #17060.
Due to a race condition, sometimes
hydrateDashboard
was dispatched aftersetActiveTabs
. 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 inuseEffect
, 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 replaceduseEffect
with anif
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
ADDITIONAL INFORMATION
CC @junlincc