Skip to content
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(explore): double resize triggered #24886

Merged
merged 5 commits into from
Aug 8, 2023

Conversation

justinpark
Copy link
Member

SUMMARY

Since the chart container triggers the resize handler by both props and state, it often tends to trigger rendering twice.
This commit debounces the resize function to prevent accidental duplicate resize calls.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

After:

after--double-resize.mov
after--double-resize-perf.mov

Before:

before--double-resize.mov
before--double-resize-perf.mov

TESTING INSTRUCTIONS

Go to dashboard and resize the window

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Merging #24886 (9594500) into master (554ef07) will decrease coverage by 0.01%.
Report is 8 commits behind head on master.
The diff coverage is 84.61%.

❗ Current head 9594500 differs from pull request most recent head 87dfa52. Consider uploading reports for the commit 87dfa52 to get more accurate results

@@            Coverage Diff             @@
##           master   #24886      +/-   ##
==========================================
- Coverage   69.00%   69.00%   -0.01%     
==========================================
  Files        1906     1906              
  Lines       74142    74120      -22     
  Branches     8208     8208              
==========================================
- Hits        51160    51143      -17     
+ Misses      20859    20854       -5     
  Partials     2123     2123              
Flag Coverage Δ
javascript 55.84% <60.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
.../src/dashboard/components/gridComponents/Chart.jsx 59.29% <60.00%> (+1.03%) ⬆️
superset/config.py 92.20% <100.00%> (+0.02%) ⬆️
superset/security/manager.py 94.43% <100.00%> (+0.66%) ⬆️
superset/utils/core.py 90.50% <100.00%> (+0.13%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@michael-s-molina
Copy link
Member

@justinpark Could you check if we can remove the resizeTimeout logic with this PR?

if (nextProps.isFullSize !== this.props.isFullSize) {
  clearTimeout(this.resizeTimeout);
  this.resizeTimeout = setTimeout(this.resize, RESIZE_TIMEOUT);
  return false;
}

if (
  nextProps.width !== this.props.width ||
  nextProps.height !== this.props.height ||
  nextProps.width !== this.state.width ||
  nextProps.height !== this.state.height
) {
  clearTimeout(this.resizeTimeout);
  this.resizeTimeout = setTimeout(this.resize, RESIZE_TIMEOUT);
}

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Aug 4, 2023
Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for the improvement @justinpark!

@justinpark justinpark merged commit 340bfd8 into apache:master Aug 8, 2023
@michael-s-molina michael-s-molina added the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Aug 10, 2023
michael-s-molina pushed a commit that referenced this pull request Aug 10, 2023
@mistercrunch mistercrunch added 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants