SCAL-334772 Extract full-height support into a shared module - #641
Open
shivam-kumar-ts wants to merge 2 commits into
Open
SCAL-334772 Extract full-height support into a shared module#641shivam-kumar-ts wants to merge 2 commits into
shivam-kumar-ts wants to merge 2 commits into
Conversation
commit: |
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the full-height and lazy-loading logic for AppEmbed and LiveboardEmbed by extracting it into a new, dedicated FullHeightController class. This centralizes height negotiation, query parameter additions, and viewport listeners for lazy loading, improving code modularity and testability. Corresponding tests have been updated, and a new test suite src/full-height.spec.ts has been added. Additionally, the inline iframe center calculation in TsEmbed has been replaced with a helper function calculateElementCenter in utils.ts.
Feedback is provided regarding a style guide violation in src/types.ts, where the non-standard @type tag is used in TSDoc comments.
shivam-kumar-ts
force-pushed
the
SCAL-334772
branch
2 times, most recently
from
August 26, 2026 15:20
9477f62 to
1fa4c7f
Compare
shivam-kumar-ts
force-pushed
the
SCAL-334772
branch
from
August 26, 2026 15:21
1fa4c7f to
9c61e12
Compare
sastaachar
reviewed
Aug 27, 2026
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.
What
The full-height feature was implemented twice, verbatim — once in
LiveboardEmbedand once inAppEmbed. This PR extracts it into a singleFullHeightControllerinsrc/full-height.ts, backed by a sharedFullHeightViewConfigtype, and deletes ~470 lines of duplication from the embed classes.No change to the public API surface:
fullHeight,minimumHeight,defaultHeight,lazyLoadingForFullHeight,lazyLoadingMarginandenableScrollableContainerLazyLoadingare accepted by exactly the same embeds as before, with the same semantics.Why
Both embeds carried identical copies of
sendFullHeightLazyLoadData,requestVisibleEmbedCoordinatesHandler,updateIFrameHeight,embedIframeCenter,setIframeHeightForNonEmbedLiveboard,registerLazyLoadEventsandunregisterLazyLoadEvents, plus the same three state fields, the same constructor wiring and the same query-param block. TheliveboardRelatedRouteslist was duplicated character-for-character. A third copy of the viewport math lived inTsEmbed.getIframeCenter().Every fix to this feature had to land in two or three places, and the two copies had already drifted (
AppEmbedsilently ignoreddefaultHeight).How
src/full-height.ts(new) —FullHeightControllerowns all full-height state, event handlers, query params and listener lifecycle. It talks to the embed through a 4-methodFullHeightEmbedHostcontract (getIframe/setFrameHeight/on/trigger), so it needs nothing from the embed class hierarchy. Inert unlessfullHeightis enabled.src/types.ts—FullHeightViewConfigholds the six full-height props;LiveboardViewConfigandAppViewConfigextend it and drop their duplicated declarations.src/utils.ts—calculateElementCenter(element)generalises the viewport math that was inlined inTsEmbed.src/embed/{app,liveboard}.ts— reduced to constructing the controller and forwarding four lifecycle calls.src/embed/ts-embed.ts—getIframeCenter()is now a thin delegate tocalculateElementCenter.The
defaultHeightmutation that used to happen as a side effect ofgetEmbedParamsObject()is now aminimumHeightgetter derived from the view config, removing the ordering dependency between param building and height events.src/embed/app.tssrc/embed/liveboard.tssrc/embed/ts-embed.tssrc/full-height.tssrc/types.tssrc/utils.tsBehavior change⚠️
AppEmbednow honoursdefaultHeight. It previously resolvedminimumHeight || 500and ignoreddefaultHeightentirely;LiveboardEmbedresolvedminimumHeight || defaultHeight || 500. The shared getter applies the Liveboard rule to both.This is additive and non-breaking — passing
defaultHeighttoAppEmbedwas a TypeScript excess-property error before, so no typed consumer can regress.minimumHeightstill wins where both are set.