Skip to content

Questions about lifecyle and the triggering of event #3443

@remiHau

Description

@remiHau

Hi,

We are planning to use shepherd to showcase our application because it seems to be a really good tour application. But before purchasing the license , we made some tests to see if we were able to do everything we needed and we met an issue, maybe you will be able to explain us what we are doing wrong or the logic behind it.

First of all, to explain a bit the context, we are showcasing the application and it works really well for simple case where the htmlElement to showcase is available in the DOM, but for one specific case we need to perform some actions before and after the step (in this specific case, open a three-dots menu before the step and close it after it). So to do that, we plugged the application with the hook event of the step (beforeShowPromise, to open the menu and hide/destroy to close the menu). We encountered an issue where the destroyed event was called, whenever we went back to the step, which closed again the menu on a back->next action.

By searching into the code, we found out that since this commit linked to this issue, the destroy event is always called, which make the hide state a bit pointless.
So we thought calling the destroy method in the hide hook, to be sure that the element was destroyed and not be destroyed again on show, but since the same commit, the condition to call the destroy event is to check if it is undefined and not falsy as before, but the destroy method set the htmlElement to null and not to undefined so even if it is destroyed, the destroy method will be always called.

It's possible that we misunderstood the flow or some specific conditions, but do you think it would be possible to either change the condition of destruction during the show, to be null or undefined or to change the destruction method so it set the internal this.el to undefined instead?

If you don't have the time to do that, we would also be happy to create a PR to do thoses changes.

Thank you for your time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions