Skip to content

[SCAL-327613] Add Spotter routes to fullHeight height-reset allowlist - #652

Open
shikharbsar wants to merge 1 commit into
mainfrom
SCAL-327613
Open

[SCAL-327613] Add Spotter routes to fullHeight height-reset allowlist#652
shikharbsar wants to merge 1 commit into
mainfrom
SCAL-327613

Conversation

@shikharbsar

Copy link
Copy Markdown
Contributor

Spotter (conv-assist) routes were missing from the RouteChange allowlist that skips the fullHeight iframe height reset, causing the embed to collapse to defaultHeight when navigating into or within Spotter.

  • Add /insights/conv-assist and /embed/insights/conv-assist to liveboardRelatedRoutes in app.ts and liveboard.ts
  • Add pinning tests for the bare landing route and the conversation-id URL variant

Spotter (conv-assist) routes were missing from the RouteChange
allowlist that skips the fullHeight iframe height reset, causing
the embed to collapse to defaultHeight when navigating into or
within Spotter.

- Add /insights/conv-assist and /embed/insights/conv-assist to
  liveboardRelatedRoutes in app.ts and liveboard.ts
- Add pinning tests for the bare landing route and the
  conversation-id URL variant
@shikharbsar
shikharbsar requested a review from a team as a code owner September 2, 2026 19:25

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds Spotter (conv-assist) routes to the liveboardRelatedRoutes array in both AppEmbed and LiveboardEmbed to prevent resetting the iframe height during navigation, along with corresponding unit tests. The review feedback highlights a potential partial prefix matching bug due to the lack of trailing slashes on the new routes, and suggests extracting the duplicated route array and matching logic into a shared constants file.

Comment thread src/embed/app.ts
Comment on lines +1506 to +1507
'/insights/conv-assist',
'/embed/insights/conv-assist',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

1. Potential Partial Prefix Match Bug

Because '/insights/conv-assist' and '/embed/insights/conv-assist' do not end with a trailing slash (unlike the other routes in the list), currentPath.startsWith(path) will match any path that has this prefix, such as /insights/conv-assist-settings or /insights/conv-assist-helper if they exist.

Recommendation:
To prevent accidental partial matches and normalize the route matching logic, consider removing trailing slashes from all routes in liveboardRelatedRoutes and updating the matching condition to check for either an exact match or a sub-path match:

if (
    liveboardRelatedRoutes.some(
        (path) =>
            data.data.currentPath === path ||
            data.data.currentPath.startsWith(path + '/'),
    )
)

2. Code Duplication

The liveboardRelatedRoutes array and the setIframeHeightForNonEmbedLiveboard logic are duplicated across AppEmbed (src/embed/app.ts) and LiveboardEmbed (src/embed/liveboard.ts).

Recommendation:
Consider extracting liveboardRelatedRoutes to a shared constants file (e.g., src/config.ts or a new constants module) and importing it in both files. This prevents duplication, improves maintainability, and ensures the routes do not get out of sync in future updates.

Comment thread src/embed/liveboard.ts
Comment on lines +1107 to +1108
'/insights/conv-assist',
'/embed/insights/conv-assist',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

1. Potential Partial Prefix Match Bug

Because '/insights/conv-assist' and '/embed/insights/conv-assist' do not end with a trailing slash (unlike the other routes in the list), currentPath.startsWith(path) will match any path that has this prefix, such as /insights/conv-assist-settings or /insights/conv-assist-helper if they exist.

Recommendation:
To prevent accidental partial matches and normalize the route matching logic, consider removing trailing slashes from all routes in liveboardRelatedRoutes and updating the matching condition to check for either an exact match or a sub-path match:

if (
    liveboardRelatedRoutes.some(
        (path) =>
            data.data.currentPath === path ||
            data.data.currentPath.startsWith(path + '/'),
    )
)

2. Code Duplication

The liveboardRelatedRoutes array and the setIframeHeightForNonEmbedLiveboard logic are duplicated across AppEmbed (src/embed/app.ts) and LiveboardEmbed (src/embed/liveboard.ts).

Recommendation:
Consider extracting liveboardRelatedRoutes to a shared constants file (e.g., src/config.ts or a new constants module) and importing it in both files. This prevents duplication, improves maintainability, and ensures the routes do not get out of sync in future updates.

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@thoughtspot/visual-embed-sdk@652

commit: 8179ecc

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.

1 participant