SCAL-342254 Send the embed config in APP_INIT when excludeConfigFromURL is set, to stop flicker on first load - #696
shivam-kumar-ts wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds layout and chrome flags (including navigation, page versions, Liveboard layout, search layout, and Spotter experience flags) to the BOOTSTRAP_URL_PARAMS set to ensure they are included in the initial render URL. It also updates the unit tests to verify these flags are preserved. The review feedback recommends adding missing Spotter sidebar flags (Param.EnablePastConversationsSidebar and Param.SpotterSidebarDefaultExpanded) to the bootstrap parameters to prevent UI flickering during the initial load.
commit: |
3ec1dd7 to
1c049d4
Compare
1c049d4 to
2feb925
Compare
b0b6fe8 to
565ee9b
Compare
|
@gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors how configuration parameters are sent to the embedded application when config exclusion is enabled. Instead of sending excluded parameters via UpdateEmbedParams after the frame is ready, they are now held back from the URL and delivered directly in the APP_INIT payload. This change includes updates to BOOTSTRAP_URL_PARAMS, the addition of a helper withExcludedUrlParams to merge these parameters, and comprehensive unit tests. A review comment suggests ensuring that properties with undefined values are not added to excludedParams to prevent isEmpty from incorrectly returning false and failing to reset this.excludedUrlParams to null.
SCAL-342254 Keep the layout flags on the iframe URL when excludeConfigFromURL is set
With excludeConfigFromURL set, only the params in BOOTSTRAP_URL_PARAMS
stay on the iframe src. The rest arrive over HostEvent.UpdateEmbedParams
after the app has loaded. Several of those late params decide the first
render: navigation, page versions, the Liveboard header and grid, the
search bar and its initial query, and Spotter's empty screen. The app
painted its default layout first and then switched, so the embed
flickered.
Add 62 layout and navigation flags to BOOTSTRAP_URL_PARAMS (38 -> 100),
grouped by area: app navigation, page versions, Liveboard layout,
search layout and initial query, and Spotter's experience and empty
screen. Each one is still added to the URL only when the caller sets
it.
Action and tab lists (HideActions, VisibleActions, DisableActions,
PrimaryAction, HiddenTabs, VisibleTabs) and behavior-only flags still
go over UpdateEmbedParams.
Update the excludeConfigFromURL tests: drop the checks that
isPinboardV2Enabled and enableDataPanelV2 stay off the URL, and add a
test that the layout flags stay on it.
Problem
With the
excludeConfigFromURLadditional flag, only the params inBOOTSTRAP_URL_PARAMSstayed on the iframesrc. Everything else was sentover
HostEvent.UpdateEmbedParamsafterEmbedListenerReady, which is afterthe app's first render. Many of those params decide what the first render
looks like: navigation, page versions, the Liveboard header and grid, the
search bar and its initial query, and Spotter's empty screen. The app painted
its default layout first and then switched once the params arrived, so the
embed flickered.
Fix
Send the held-back params in the
APP_INITresponse instead. The app alreadywaits for
APP_INITbefore its first render (appInit()inblink-v2awaits
onEmbedInitbeforerenderApp), and already reads it in the twoplaces a URL load feeds:
setEmbedInitData→overrideFlags(_.pick(data, Object.keys(FLAGS))).26 of the layout params are read this way, for example
primaryNavHidden,isPinboardV2Enabled,navigationVersionandenableDataPanelV2.embedParamsseeds the embed container's first-render state,ahead of the URL (
embed.container.tsx, throughgetEmbedQueryParamsFromInitData).So every held-back param goes in both. No change is needed on the
ThoughtSpot app side.