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

feat(dashboard): run query for chart only if visible #21488

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Sep 15, 2022

SUMMARY

Since the current Dashboard requests entire apis for runQuery all together, it easily exceeds the maximum parallel HTTP connections.
This commit introduces the react-intersection-observer to minimize the runQuery for charts.
It will only request the runQuery only if the current Chart is within the visible viewport. (As scroll down to the bottom chart, it will gradually request the remaining runQuery.)

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

  • Before:
before--inview.mov
  • After:
after--inview.mov

TESTING INSTRUCTIONS

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

</div>
{isLoading && !isDeactivatedViz && <Loading />}
</Styles>
<InView triggerOnce onChange={this.handleChartInView}>
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a rootMargin to page bottom so charts near the bottom but below the fold can load faster (so users can see less loading states)?

Copy link
Member

@stephenLYZ stephenLYZ left a comment

Choose a reason for hiding this comment

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

It looks like #21438 from @kgabryje does the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants