Skip to content

SCAL-279300 : optimize FullHeight recalc#466

Open
sastaachar wants to merge 7 commits intomainfrom
SCAL-279300
Open

SCAL-279300 : optimize FullHeight recalc#466
sastaachar wants to merge 7 commits intomainfrom
SCAL-279300

Conversation

@sastaachar
Copy link
Contributor

No description provided.

@sastaachar sastaachar requested a review from a team as a code owner March 16, 2026 11:17
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request optimizes the behavior of embedded iframes by introducing a height change threshold. This enhancement prevents the iframe from frequently resizing for minor height adjustments, which can lead to visual instability and performance overhead. By only applying height updates when the change is significant, the PR aims to provide a smoother and more efficient user experience for embedded ThoughtSpot applications and liveboards.

Highlights

  • Iframe Height Optimization: Introduced a HEIGHT_CHANAGE_THRESHOLD constant (set to 30 pixels) in AppEmbed and LiveboardEmbed classes. This threshold prevents the iframe from updating its height if the computed change is less than 30 pixels, aiming to reduce unnecessary DOM manipulations and potential visual flickering.
Changelog
  • src/embed/app.ts
    • Added HEIGHT_CHANAGE_THRESHOLD private member.
    • Modified updateIFrameHeight to check if the absolute height change exceeds HEIGHT_CHANAGE_THRESHOLD before calling setIFrameHeight.
    • Added logging for height updates and skipped updates.
  • src/embed/liveboard.ts
    • Added HEIGHT_CHANAGE_THRESHOLD private member.
    • Modified updateIFrameHeight to check if the absolute height change exceeds HEIGHT_CHANAGE_THRESHOLD before calling setIFrameHeight.
    • Added logging for skipped height updates.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sastaachar sastaachar changed the title SCAL-279300 : FullHegith SCAL-279300 : FullHeight Mar 16, 2026
Copy link
Contributor

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

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 introduces a threshold to prevent small, frequent iframe height adjustments in AppEmbed and LiveboardEmbed, which is a good improvement to prevent visual flickering. The PR title has a typo and should be "FullHeight".

My review includes a few points:

  • There's a typo in the new constant name in both files.
  • In AppEmbed, an incorrect log level (error) is used for a routine operation.
  • The new logic is duplicated across AppEmbed and LiveboardEmbed. I've suggested refactoring this into a shared location to improve maintainability.

Please see the specific comments for details.

)}`;
}

private HEIGHT_CHANAGE_THRESHOLD = 30;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's a typo in the constant name. It should be HEIGHT_CHANGE_THRESHOLD.

Suggested change
private HEIGHT_CHANAGE_THRESHOLD = 30;
private HEIGHT_CHANGE_THRESHOLD = 30;

Comment on lines 809 to 825
private HEIGHT_CHANAGE_THRESHOLD = 30;
/**
* Set the iframe height as per the computed height received
* from the ThoughtSpot app.
* @param data The event payload
*/
private updateIFrameHeight = (data: MessagePayload) => {
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
const currentHeight = this.iFrame.getBoundingClientRect().height;
const heightToSet = Math.max(data.data, this.defaultHeight);
const heightChange = Math.abs(heightToSet - currentHeight);
if (heightChange < this.HEIGHT_CHANAGE_THRESHOLD) {
logger.info('Height change is less than the threshold, skipping height update', { heightChange, heightToSet, currentHeight });
return;
}
this.setIFrameHeight(heightToSet);
this.sendFullHeightLazyLoadData();
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This constant and the updateIFrameHeight method are duplicated from src/embed/app.ts. To improve maintainability and avoid code duplication, consider moving this shared logic to a common base class like V1Embed or a utility function. This will ensure that any future changes only need to be made in one place.

@sastaachar sastaachar changed the title SCAL-279300 : FullHeight SCAL-279300 : optimize FullHeight recalc Mar 16, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 16, 2026

Open in StackBlitz

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

commit: 9e13741

sastaachar and others added 4 commits March 16, 2026 21:59
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@sonar-prod-ts
Copy link

sonar-prod-ts bot commented Mar 16, 2026

SonarQube Quality Gate

Quality Gate failed

Failed condition 9.2% 9.2% Duplicated Lines (%) on New Code (is greater than 3%)

See analysis details on SonarQube

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