Skip to content

Commit

Permalink
Preventing calling nextStep while waiting for element
Browse files Browse the repository at this point in the history
  • Loading branch information
gooddaytoday committed Jun 16, 2022
1 parent 58df7e1 commit 7930cd6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function goToStepNumber(step) {
*/
export function nextStep() {
this._direction = "forward";
if (this._waitingNextElement) return;

if (typeof this._currentStepNumber !== "undefined") {
forEach(this._introItems, ({ step }, i) => {
Expand Down Expand Up @@ -81,7 +82,11 @@ export function nextStep() {
}

if (elementBySelectorNotExists(nextStep)) {
waitForElement(nextStep._element, () => showElement.call(this, nextStep));
this._waitingNextElement = true;
waitForElement(nextStep._element, () => {
this._waitingNextElement = false;
showElement.call(this, nextStep);
});
} else {
showElement.call(this, nextStep);
}
Expand Down

0 comments on commit 7930cd6

Please sign in to comment.