LinkedInAttic / hopscotch

A framework to make it easy for developers to add product tours to their pages.
Apache License 2.0
4.2k stars 666 forks source link

onStart and onEnd being executed as soon as I start the tour. #370

Closed sergiolpf closed 5 years ago

sergiolpf commented 5 years ago

Hi guys,

I am developing a chrome extension with React and using Hopscotch as a Walkthrough lib.

I have a sidebar that is overlaying the content of the page and the trigger for Hopscotch tour in there, so I am dispatching an action to hide the sidebar, run the tour and my expectation is to show the sidebar again after the end of the tour. However this is not happening, the onStart and onEnd events are being triggered one after the other straight away.

my code is as follows:

var tour = {
      id:"idTest",
      steps: [
        {
          content:"bla bla bla",
          placement:"right",
          target:".tooltipped-s > .avatar",
          title:"sdfsd"
        },
        {   
          target:":nth-child(1) > .pinned-repo-item-content > span.d-block",
          placement:"right",
          title:"bla",
          content:" sdfkljsdef "      
        } 
      ],
      onStart: dispatch(showPreviewSteps()),
      onEnd: dispatch(closePreviewSteps())
    };

hopscotch.startTour(tour, 0)

Is this a bug?

sergiolpf commented 5 years ago

Hi,

I have changed the code to be like:

...
 onStart: function() {
   dispatch(showPreviewSteps());
}

and it worked... not a defect then.

Thanks