fix(full-height): reset the frame height when a different Liveboard opens - #674
sastaachar wants to merge 1 commit into
Conversation
…pens A full-height frame is expanded to the whole Liveboard, so after a tall board the frame is left thousands of pixels tall. RouteChange only reset the height when the app left the Liveboard experience altogether; moving from one Liveboard to another returned early and kept the previous board's height. That carries the old height into the new board: the embedded app's own window.innerHeight is the tall board's height, so anything falling back to the iframe viewport treats the whole board as on-screen and resolves every visualization at once — the lazy loading the host app asked for quietly stops happening on the second Liveboard. Track the Liveboard the frame is sized for and reset to frameParams.height, or the minimum height, when a different one opens. A route change within the same Liveboard is left alone so the frame does not jump while drilling into a visualization. Ref: SCAL-332771 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates the FullHeightController to reset the frame height when navigating between different Liveboards, which prevents lazy loading issues caused by carrying over a tall Liveboard's height to a new one. It introduces a regex to extract the Liveboard ID from the route path and resets the height if the ID changes. Comprehensive unit tests have been added to verify this behavior. The review feedback recommends normalizing the extracted Liveboard GUID to lowercase to ensure case-insensitive comparison robustness.
| const liveboardId = LIVEBOARD_ID_IN_PATH.exec(currentPath)?.[0]; | ||
| if (!liveboardId) { | ||
| return; | ||
| } | ||
| const isDifferentLiveboard = this.currentLiveboardId !== undefined | ||
| && this.currentLiveboardId !== liveboardId; | ||
| this.currentLiveboardId = liveboardId; |
There was a problem hiding this comment.
Comparing GUIDs directly without case normalization can lead to unexpected behavior if the URL contains uppercase hex characters (e.g., A3E48B45-... vs a3e48b45-...). Normalizing the extracted liveboardId to lowercase ensures robust case-insensitive comparisons.
| const liveboardId = LIVEBOARD_ID_IN_PATH.exec(currentPath)?.[0]; | |
| if (!liveboardId) { | |
| return; | |
| } | |
| const isDifferentLiveboard = this.currentLiveboardId !== undefined | |
| && this.currentLiveboardId !== liveboardId; | |
| this.currentLiveboardId = liveboardId; | |
| const liveboardId = LIVEBOARD_ID_IN_PATH.exec(currentPath)?.[0]?.toLowerCase(); | |
| if (!liveboardId) { | |
| return; | |
| } | |
| const isDifferentLiveboard = this.currentLiveboardId !== undefined | |
| && this.currentLiveboardId !== liveboardId; | |
| this.currentLiveboardId = liveboardId; |
commit: |
What
In a full-height embed, reset the iframe height to its default when the app navigates from one Liveboard to another.
FullHeightController.handleRouteChangeonly reset the height when the app left the Liveboard experience altogether. Any route inLIVEBOARD_RELATED_ROUTESreturned early, so Liveboard → Liveboard kept the height of the board being left behind:Why it matters
A full-height frame is expanded to the whole Liveboard, so after a tall board the frame is left thousands of pixels tall. Carry that into the next Liveboard and the embedded app's own
window.innerHeightis still the previous board's height. Anything that falls back to the iframe viewport as its IntersectionObserver root then treats the entire board as on-screen and resolves every visualization at once — solazyLoadingForFullHeightquietly stops taking effect from the second Liveboard onward, which is what a customer reported as a 22s load on a 32-tile board.How
/embed/viz/<liveboard>/<viz>resolves to the Liveboard).frameParams.height, or the minimum height, when a different Liveboard opens.Tests
src/full-height.spec.ts— 7 new cases underRouteChange › moving between Liveboards. Three of them fail if the source change is reverted (verified):frameParams.heightwhen one is configuredThe rest pin the cases that must NOT reset: the first Liveboard, navigation within one Liveboard, and the board opened after leaving the experience.
Existing
RouteChangetests are unaffected — they use non-GUID paths such as/pinboard/abc, which carry no Liveboard id and so keep their current behaviour.Full suite: 1859 passed, 46 suites, 4 skipped.
tscandeslintclean.Notes
This is one of two defects found under SCAL-332771. The other — that
postRender()is reachable only fromrender(), so a pre-rendered embed attaches no scroll/resize listeners at all — is a separate change and is not in this PR.Ref: SCAL-332771
🤖 Generated with Claude Code