Skip to content

[9.2] [Dashboard] Fix search session restoration bug (#239822)#240176

Closed
kibanamachine wants to merge 1 commit intoelastic:9.2from
kibanamachine:backport/9.2/pr-239822
Closed

[9.2] [Dashboard] Fix search session restoration bug (#239822)#240176
kibanamachine wants to merge 1 commit intoelastic:9.2from
kibanamachine:backport/9.2/pr-239822

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 9.2:

Questions ?

Please refer to the Backport tool documentation

Questions ?

Please refer to the Backport tool documentation

Questions ?

Please refer to the Backport tool documentation

Part of elastic#239610

## Summary

Previously, we were **never** hitting the search session cache for
dashboards with controls because we were removing the search session ID
from the URL and generating a new session once controls published their
filters, which lead us to fetch the **new** ID rather than the saved
one:

<img width="1814" height="1061" alt="SearchSessionMismatch"
src="https://github.com/user-attachments/assets/bd7f0f62-99c9-4537-ac56-863162f5e0fb"
/>

> [!NOTE]
> Notice in the above network request that `isRestore` is false, which
shows that we are not restoring an existing search session
(`dd41248d-3dd7-41e6-99f0-e30c6b4a87f1`); instead; we are fetching from
the newly generated one (`1f48aacc-90c5-4081-8157-b9b6d77b33b4`).

This was because we weren't awaiting the dashboard controls to publish
their filters, which caused `newSession$` to emit prematurely and
triggered removing the search session ID from the URL before the search
session actually had a chance to be restored. Now, we avoid generating a
new search session ID until **after** controls have published their
filters.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 5b0b2dc)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Oct 22, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) October 22, 2025 20:51
@elasticmachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps

cc @Heenawter

@Heenawter
Copy link
Contributor

Closing - cannot backport because #237524 didn't merge

@Heenawter Heenawter closed this Oct 22, 2025
auto-merge was automatically disabled October 22, 2025 21:45

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants