fix: preserve embed params on back-to-search navigation and consolida…#3782
Open
aditya86-id wants to merge 1 commit intojaegertracing:mainfrom
Open
fix: preserve embed params on back-to-search navigation and consolida…#3782aditya86-id wants to merge 1 commit intojaegertracing:mainfrom
aditya86-id wants to merge 1 commit intojaegertracing:mainfrom
Conversation
…te embedded state functions Problem: Embed params (uiEmbed=v0, uiSearchHideGraph=1, etc.) were silently dropped when navigating Search → Trace → Back to Search, breaking embedded UI context. Solution: 1. Split single computed URL into two separate URLs in SearchResults: - backNavUrl: preserves embed params for 'Back to Search' navigation - standaloneUrl: strips embed params for standalone new-tab link 2. Moved getEmbeddedState() and stripEmbeddedState() from utils/embedded-url.ts to stores/embedded-store.ts (eliminating unnecessary indirection) 3. Added forbidNewPage guard to prevent rendering standalone link when forbidNewPage config is true 4. Updated tests to reflect new behavior and consolidate test coverage This ensures users maintain embedded context when clicking 'Back to Search' while intentionally stripping embed context for standalone links. Signed-off-by: adityakumartiwary <adityatiwary888@gmail.com>
d734fd6 to
de19a26
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
Resolves #3780
Description
While tracing the embedded mode flow, I noticed that navigating
Search → Trace → Back to Search silently drops uiEmbed=v0 and related
params from the return URL.
The root cause: SearchResults/index.tsx computed a single searchUrl via
stripEmbeddedState() and reused it for both fromSearch back-navigation
and the standalone new-tab link — even though only the latter should
have embed params stripped.
Fix: split into two explicit URLs:
the same embedded context
intent from PR Revisions for search and trace detail embed mode #286)
Also hid the standalone link when forbidNewPage=true. Its only purpose
is opening search in a new tab outside the embed context — forcing
same-frame navigation to a stripped URL actively breaks the config.
On the refactor side, getEmbeddedState() and stripEmbeddedState() each
had exactly one caller, both embed-related. Moved both into
stores/embedded-store.ts, deleted utils/embedded-url.ts, and moved the
tests with them. The vi.mock of embedded-url in embedded-store.test.ts
is replaced with tests against the real implementations.
Checklist
AI Usage