Skip to content

disableActions is preserved between steps #683

@mzawka

Description

@mzawka

Description

Hi! I noticed that when I disable actions on a step with disableActions: true, this setting persists on subsequent steps. Actions can only be reenabled by explicitly setting disableActions to false on the next step. Is this an intended behavior?

Steps to reproduce

You can observe this behavior in this code sandbox: https://codesandbox.io/p/sandbox/thirsty-cache-zz6yzk

Expected behavior

disableActions: true should not be preserved between steps. The next step without this setting should be interactive.

Potential root cause

In the Tour implementation, the state variable that controls whether actions are disabled only changes when step.disableActions is defined. This explains why actions can only be reenabled by explicitly setting disableActions to false.

// packages/tour/Tour.tsx, line 111
useEffect(() => {
  if (step?.action && typeof step?.action === 'function') {
    step?.action(target)
  }

  if (step?.disableActions !== undefined) { // ⬅️ here
    setDisabledActions(step?.disableActions)
  }

  return () => {
    if (step?.actionAfter && typeof step?.actionAfter === 'function') {
      step?.actionAfter(target)
    }
  }
}, [step])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions