Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next step is not updated when it has an action defined and root component uses ChangeDetectionStrategy.OnPush #93

Open
Chris380 opened this issue Aug 18, 2021 · 0 comments

Comments

@Chris380
Copy link

I work in a project where all components (app.component included) use ChangeDetectionStrategy.OnPush. When I step through the tour, the click on 'next' will not update the highlighted element and the text, if the next element has an action.

steps to reproduce

  • use ChangeDetectionStrategy.OnPush in your root (app.component.ts)
  • implement a tour with three steps
  • set action of the second step to () => { }
  • start the tour
  • click on 'next' in step one

expected behaviour
The element of step two is highlighted, the correct text is shown

actual behaviour
The element of step one is highlighted and its text is shown

my dicoveries

  • updating app.component to ChangeDetectionStrategy.Default fixes the issue
  • a click on the step text itself after the next in step one updates the view and step two is correctly shown
  • a click on next in step one does update the buttons, the prev-button appears
  • the setTimeout following part seems to be crucial:
if (this._currentTour.steps[this._currentTourStepIndex].action) {
                this._currentTour.steps[this._currentTourStepIndex].action();
                // Usually an action is opening something so we need to give it time to render.
                setTimeout((/**
                 * @return {?}
                 */
                () => {
@Chris380 Chris380 changed the title Next step is not updated when it has an action defined and root component usesChangeDetectionStrategy.OnPush Next step is not updated when it has an action defined and root component uses ChangeDetectionStrategy.OnPush Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant