feat: continue when target not found #190
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
I'm adding this PR, here's the explanation why:
First change in Vstep.vue:
In our use case, we needed to have a new property when we rendered a component recursively.
The standard behaviour of the library is that, when a target component is not found, it fails and stops, but we needed it to jump to our next target, or step.
But to achieve that, we needed to also modify the behaviour of step advancing and backing, so we added a new options prop:
continueWhenTargetNotFound.
This prop is by default set to false, keeping the library standard behaviour, and when you need it to jump to the next step or the previous one, like we did, you can change it to true.
Second change in Vstep.vue:
I added an "if" statement to the removeHighlight function, because when the previous/next step target wasn't yet rendered, it would throw an error, so with this change it will only try to remove it, if it exists.