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): Prevent rerendering View Query modal on window resize #15172
Conversation
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.
I just ran into this today, thanks for fixing! LGTM once passes lint (I assume useCallback
isn't needed here).
@@ -16,7 +16,7 @@ | |||
* specific language governing permissions and limitations | |||
* under the License. | |||
*/ | |||
import React, { useEffect, useState } from 'react'; | |||
import React, { useEffect, useState, useCallback } from 'react'; |
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.
This doesn't appear to be needed here?
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.
Ugh, forgot to remove it. Thanks!
Codecov Report
@@ Coverage Diff @@
## master #15172 +/- ##
==========================================
- Coverage 77.41% 77.25% -0.17%
==========================================
Files 969 969
Lines 49999 50011 +12
Branches 6424 6431 +7
==========================================
- Hits 38705 38634 -71
- Misses 11091 11174 +83
Partials 203 203
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…apache#15172) * fix(dashboard): Prevent rerendering View Query modal on window resize * Fix lint
…apache#15172) * fix(dashboard): Prevent rerendering View Query modal on window resize * Fix lint
…apache#15172) * fix(dashboard): Prevent rerendering View Query modal on window resize * Fix lint
SUMMARY
Due to using a complex javascript object in
useEffect
's dependency array inViewQueryModal
, we were rerunning API request on every rerender of the modal (including resizing window). I fixed it by usingJSON.stringify
method in the dependency array.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: see #14696
After:
https://user-images.githubusercontent.com/15073128/122034659-070c3980-cdd2-11eb-8617-6650cf4b3c43.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
CC: @junlincc