Skip to content

Commit 7930cd6

Browse files
committed
Preventing calling nextStep while waiting for element
1 parent 58df7e1 commit 7930cd6

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) => {
@@ -81,7 +82,11 @@ export function nextStep() {
8182
}
8283

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

0 commit comments

Comments
 (0)