Skip to content

Commit 87fa604

Browse files
gooddaytodaykiselev
authored andcommitted
Preventing calling nextStep while waiting for element
1 parent 6d37653 commit 87fa604

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/core/steps.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export function goToStepNumber(step) {
3838
*/
3939
export function nextStep() {
4040
this._direction = "forward";
41+
if (this._waitingNextElement) return;
4142

4243
if (typeof this._currentStepNumber !== "undefined") {
4344
forEach(this._introItems, ({ step }, i) => {
@@ -82,7 +83,11 @@ export function nextStep() {
8283
}
8384

8485
if (elementBySelectorNotExists(nextStep)) {
85-
waitForElement(nextStep._element, () => showElement.call(this, nextStep));
86+
this._waitingNextElement = true;
87+
waitForElement(nextStep._element, () => {
88+
this._waitingNextElement = false;
89+
showElement.call(this, nextStep);
90+
});
8691
} else {
8792
showElement.call(this, nextStep);
8893
}

0 commit comments

Comments
 (0)