Skip to content

Commit

Permalink
Fix: Avoid redundant getpresentationinfo call when `startPresentati…
Browse files Browse the repository at this point in the history
…on` parameter is used

- Added a `_startingPresentation` flag to track the state of the presentation startup.
- Modified the `onUpdateParts` method to prevent redundant `getpresentationinfo` calls during initialization.
- Updated the presentation start logic to set the flag when the presentation begins, ensuring the request is sent only once.

Signed-off-by: Darshan-upadhyay1110 <[email protected]>
Change-Id: Ib1edc8b57a3ec879db93cffbd649b5b96d0004f4
  • Loading branch information
Darshan-upadhyay1110 authored and timar committed Jan 17, 2025
1 parent f2fc260 commit e6dd453
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions browser/src/slideshow/SlideShowPresenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class SlideShowPresenter {
private _cypressSVGPresentationTest: boolean = false;
private _onKeyDownHandler: (e: KeyboardEvent) => void;
private _onImpressModeChanged: any = null;
private _startingPresentation: boolean = false;

constructor(map: any) {
this._cypressSVGPresentationTest =
Expand Down Expand Up @@ -172,7 +173,8 @@ class SlideShowPresenter {
}

private onUpdateParts() {
if (this._checkAlreadyPresenting()) this.onSlideShowInfoChanged();
if (this._checkAlreadyPresenting() && !this._startingPresentation)
this.onSlideShowInfoChanged();
}

public getNavigator() {
Expand Down Expand Up @@ -407,6 +409,7 @@ class SlideShowPresenter {
}

this._canvasLoader.startLoader();
this._startingPresentation = false;
}

public stopLoader(): void {
Expand Down Expand Up @@ -705,7 +708,7 @@ class SlideShowPresenter {
return;
// disable slide sorter or it will receive key events
this._map._docLayer._preview.partsFocused = false;

this._startingPresentation = true;
app.socket.sendMessage('getpresentationinfo');
}

Expand All @@ -717,6 +720,7 @@ class SlideShowPresenter {
return;
// disable present in console onStartInWindow
this._enablePresenterConsole(true);
this._startingPresentation = true;
app.socket.sendMessage('getpresentationinfo');
}

Expand Down

0 comments on commit e6dd453

Please sign in to comment.