Skip to content

[Embeddable] Allow panels to pause data fetching#235266

Merged
ThomThomson merged 5 commits intoelastic:mainfrom
ThomThomson:embeddable/pauseFetch
Oct 3, 2025
Merged

[Embeddable] Allow panels to pause data fetching#235266
ThomThomson merged 5 commits intoelastic:mainfrom
ThomThomson:embeddable/pauseFetch

Conversation

@ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Sep 16, 2025

Summary

Gives the Embeddable system the ability to arbitrarily pause and unpause fetching, while allowing panels to continue with code-loading tasks.

This will be used to increase performance of the double fetch bug fix for controls, and will be used to fetch data for visible panels only.

delay

Notice how in the gif above the panels are finished their initialization but there are no network requests for data yet. When isFetchPaused$ is turned back to false the network requests begin.

How to test

This code is currently unused in the actual product, however you can test its behaviour by adding isFetchPaused$ to the Dashboard API. Add isFetchPaused$: concat(of(true), of(false).pipe(delay(10000))), after line 129 of src/platform/plugins/shared/dashboard/public/dashboard_api/get_dashboard_api.ts

@ThomThomson
Copy link
Contributor Author

/ci

@ThomThomson ThomThomson changed the title Gives the embeddable system the ability to pause and unpause fetching [Embeddable] Allow panels to pause data fetching Sep 16, 2025
@ThomThomson
Copy link
Contributor Author

/ci

@ThomThomson
Copy link
Contributor Author

/ci

@ThomThomson
Copy link
Contributor Author

/ci

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 605 607 +2
apm 2013 2015 +2
canvas 1384 1386 +2
cases 1174 1176 +2
controls 398 400 +2
dashboard 706 708 +2
dashboardEnhanced 124 126 +2
dashboardMarkdown 102 104 +2
dataVisualizer 812 814 +2
discover 1616 1618 +2
discoverEnhanced 85 87 +2
embeddable 110 112 +2
embeddableAlertsTable 546 548 +2
embeddableEnhanced 84 86 +2
imageEmbeddable 159 161 +2
inputControlVis 109 111 +2
lens 1418 1420 +2
links 136 138 +2
maps 1288 1290 +2
ml 2539 2541 +2
presentationPanel 156 158 +2
reporting 227 229 +2
securitySolution 8294 8296 +2
slo 1271 1273 +2
synthetics 1368 1370 +2
triggersActionsUi 997 999 +2
urlDrilldown 87 89 +2
visTypeVega 567 569 +2
visualizations 550 552 +2
total +58

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/presentation-publishing 230 234 +4

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
aiops 525.4KB 526.3KB +904.0B
cases 1.4MB 1.4MB +6.0B
controls 489.1KB 489.1KB +61.0B
dashboard 660.5KB 660.5KB +6.0B
dashboardEnhanced 66.6KB 66.6KB +6.0B
dashboardMarkdown 71.2KB 71.2KB +6.0B
dataVisualizer 594.1KB 595.0KB +908.0B
discover 1.2MB 1.2MB +909.0B
embeddable 59.4KB 59.4KB -1.0B
embeddableAlertsTable 1003.7KB 1004.6KB +911.0B
imageEmbeddable 111.8KB 111.8KB +6.0B
lens 1.5MB 1.5MB +2.0B
links 100.7KB 100.7KB +6.0B
maps 3.1MB 3.1MB +1.4KB
ml 5.4MB 5.4MB +904.0B
presentationPanel 99.0KB 99.0KB +6.0B
reporting 181.3KB 181.3KB +1.0B
securitySolution 11.1MB 11.1MB +12.0B
slo 974.1KB 975.0KB +918.0B
synthetics 1.0MB 1.0MB +904.0B
visTypeVega 2.1MB 2.1MB +1.0B
visualizations 350.2KB 351.0KB +904.0B
total +8.6KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
embeddable 17.0KB 17.0KB -2.0B
lens 61.2KB 62.0KB +836.0B
reporting 41.4KB 41.4KB +1.0B
visTypeVega 34.2KB 34.2KB +1.0B
total +836.0B
Unknown metric groups

API count

id before after diff
@kbn/presentation-publishing 276 280 +4

History

@ThomThomson ThomThomson added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// loe:large Large Level of Effort impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Feature:Embeddables Relating to the Embeddable system release_note:skip Skip the PR/issue when compiling release notes v9.2.0 labels Oct 2, 2025
@ThomThomson ThomThomson marked this pull request as ready for review October 2, 2025 20:54
@ThomThomson ThomThomson requested review from a team as code owners October 2, 2025 20:54
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@ThomThomson ThomThomson added the backport:version Backport to applied version labels label Oct 2, 2025
Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Code-only review, Data Discovery changes LGTM 👍

@drewdaemon
Copy link
Contributor

will be used to fetch data for visible panels only.

@ThomThomson will this be on by default?

@ThomThomson
Copy link
Contributor Author

ThomThomson commented Oct 3, 2025

@drewdaemon this PR doesn't actually add this functionality. That will be added in a followup. You can see how it will work by taking a look at #225372.

In short, it will be a Dashboard-level setting. And it will be on by default for new Dashboards. If the deferBelowFold setting is on, every Dashboard will have that setting turned on and the Dashboard authors will be unable to turn it off.

@nreese nreese self-requested a review October 3, 2025 17:36

// trigger a refetch
dashboadFilters.next([]);
dashboadFilters.next([{ meta: {} }]);
Copy link
Contributor

Choose a reason for hiding this comment

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

What does meta do? Should this use reload API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR introduces diffing into the keys of the fetch context before firing the requests. Adding this blank filter object triggers a diff which makes the request fire again. Meta is there because it's required by the type.

In this test, firing an update with a blank array fails the diff and doesn't trigger a refetch. I thought that using filters here would retain the spirit of the test better than switching to reload, but either would work IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation. Makes sense and its only a test

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presentation changes LGTM
code review only

@ThomThomson ThomThomson merged commit b54c117 into elastic:main Oct 3, 2025
29 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.2

https://github.com/elastic/kibana/actions/runs/18230425368

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 3, 2025
Gives the Embeddable system the ability to arbitrarily pause and unpause data fetching

(cherry picked from commit b54c117)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
9.2

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@ThomThomson ThomThomson added backport:skip This PR does not require backporting and removed backport:version Backport to applied version labels v9.2.0 labels Oct 3, 2025
@ThomThomson
Copy link
Contributor Author

Canceling the backport of this PR to 9.2 as the existing bugfix is enough. This will allow a performance improvement in 9.3 and above.

rylnd pushed a commit to rylnd/kibana that referenced this pull request Oct 17, 2025
Gives the Embeddable system the ability to arbitrarily pause and unpause data fetching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Dashboard Dashboard related features Feature:Embeddables Relating to the Embeddable system impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:large Large Level of Effort release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants