Skip to content

feat: defer canvas pivot/table queries until component is visible#9046

Merged
djbarnwal merged 1 commit intomainfrom
feat/pivot-canvas-visible-queries
Mar 13, 2026
Merged

feat: defer canvas pivot/table queries until component is visible#9046
djbarnwal merged 1 commit intomainfrom
feat/pivot-canvas-visible-queries

Conversation

@djbarnwal
Copy link
Copy Markdown
Member

Pivot/Table Visibility Gating for Canvas

This change extends the visibility-gating pattern (already used by KPI and chart components) to the canvas pivot/table component.

Key Changes

  • Visibility-based query execution

    • Pivot queries now only fire after the component scrolls into view.
    • This uses the existing IntersectionObserver in CanvasComponent.svelte.
  • Reactive enabled flag

    • PivotDashboardContext.enabled has been changed from:
      • booleanReadable<boolean>
    • This allows the query’s enabled flag to react to visibility changes.
  • usePivotForCanvas update

    • Now accepts:
      visible: Readable<boolean>
    • This value is passed through as the enabled context.

Explore Pivot Behaviour (Unchanged)

  • The Explore pivot path (usePivotForExplore) remains unaffected.
  • It wraps its existing static boolean in readable(...), preserving the always-enabled behaviour.

https://linear.app/rilldata/issue/APP-157/optimize-data-fetching-based-on-widget-visibility

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@djbarnwal djbarnwal requested a review from ericpgreen2 March 13, 2026 10:59
@djbarnwal djbarnwal merged commit 0284cab into main Mar 13, 2026
19 of 20 checks passed
@djbarnwal djbarnwal deleted the feat/pivot-canvas-visible-queries branch March 13, 2026 13:53
@royendo royendo mentioned this pull request Mar 31, 2026
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants