Skip to content

Commit

Permalink
do not recreate root twice in tour
Browse files Browse the repository at this point in the history
  • Loading branch information
binrysearch committed Sep 10, 2024
1 parent 4139027 commit b49fc32
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/packages/tour/tour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,10 @@ export class Tour implements Package<TourOptions> {
* Create the root element for the tour
*/
private createRoot() {
this._root = TourRoot({ tour: this });
dom.add(this.getTargetElement(), this._root);
if (!this._root) {
this._root = TourRoot({ tour: this });
dom.add(this.getTargetElement(), this._root);
}
}

/**
Expand All @@ -433,6 +435,7 @@ export class Tour implements Package<TourOptions> {
private recreateRoot() {
if (this._root) {
this._root.remove();
this._root = undefined;
this.createRoot();
}
}
Expand Down

0 comments on commit b49fc32

Please sign in to comment.