Skip to content

[Controls] Pause fetch until initialized#239228

Merged
ThomThomson merged 4 commits intoelastic:mainfrom
ThomThomson:controls/InitializationSpeedup
Oct 20, 2025
Merged

[Controls] Pause fetch until initialized#239228
ThomThomson merged 4 commits intoelastic:mainfrom
ThomThomson:controls/InitializationSpeedup

Conversation

@ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Oct 15, 2025

Summary

This PR changes the Dashboard to render all of its panels at once - even when the control group is not initialized.

To prevent double refetches the rendered panels will have their fetches paused until all controls and their initial values are ready.

Screenshot 2025-10-16 at 2 27 56 PM

How to test

  • Create a Dashboard with one Lens chart (disable the other bucket)
  • Add a control to that Dashboard and select an option
  • Empty cache and hard refresh that Dashboard.
  • You should see only one ese request in the network tab.

@ThomThomson
Copy link
Contributor Author

/ci

@ThomThomson ThomThomson added backport:skip This PR does not require backporting Feature:Dashboard Dashboard related features Feature:Input Control Input controls visualization impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// labels Oct 15, 2025
@ThomThomson ThomThomson marked this pull request as ready for review October 16, 2025 18:30
@ThomThomson ThomThomson requested a review from a team as a code owner October 16, 2025 18:30
@elasticmachine
Copy link
Contributor

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

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@nreese nreese self-requested a review October 20, 2025 14:48
getReferences.mockClear();
});

it('should return default state when no initial state is provided', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about breaking this file into blocks with a few describes. For instance, this test and next should be in a describe block for getStateForControlGroup

expect(api.controlGroupApi$.value).toBe(mockControlGroupApi);
});

it('should serialize control group state', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving this test and the next into a describe block for serializeControlGroup

@drewdaemon
Copy link
Contributor

I'm not sure how far we want to go with testing, but I'll share here a way to check the runtime request count in a Scout functional test in case it is helpful:

test('request count', async ({ page, context }) => {
  const cdp = await context.newCDPSession(page);
  await cdp.send('Network.enable');
  cdp.on('Network.requestWillBeSent', (event) => { // doc: https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-requestWillBeSent
    if (/* check event.request.url */) {
      // count requests
    }
  });

  // load page and wait for something relevant

  // assert
});

(from #237949 (comment))

@ThomThomson
Copy link
Contributor Author

Thanks for the snippet @drewdaemon! It's a great idea to write this kind of scout test, but I'd prefer to do so in a followup if that is okay for you!

@drewdaemon
Copy link
Contributor

@ThomThomson ++ definitely not a blocker, just a flyby advertisement 😁

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #15 / Cases - group 1 View case Assignees field logs in with default user assigns a user from the popover

Metrics [docs]

Async chunks

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

id before after diff
dashboard 664.1KB 664.0KB -164.0B

History

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 and tested in chrome

@ThomThomson ThomThomson merged commit 52a262c into elastic:main Oct 20, 2025
12 checks passed
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:Input Control Input controls visualization impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort release_note:fix 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.

5 participants