Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/embed/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1115,13 +1115,22 @@ export class AppEmbed extends V1Embed {
return url;
}

private HEIGHT_CHANAGE_THRESHOLD = 30;
Comment thread
sastaachar marked this conversation as resolved.
Outdated
/**
* Set the iframe height as per the computed height received
* from the ThoughtSpot app.
* @param data The event payload
*/
protected updateIFrameHeight = (data: MessagePayload) => {
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
logger.error('Updating iframe height', data);
Comment thread
sastaachar marked this conversation as resolved.
Outdated
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();
};

Expand Down
10 changes: 9 additions & 1 deletion src/embed/liveboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,13 +806,21 @@ export class LiveboardEmbed extends V1Embed {
)}`;
}

private HEIGHT_CHANAGE_THRESHOLD = 30;
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

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;

/**
* 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
Copy Markdown
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.


Expand Down
Loading