Skip to content

Custom Component with triggerNextStep ends up in loop #202

Closed

Description

@Hansl001

I use a custom component as step and in that custom component i use triggerNextStep. This makes the ChatBOt end up in an infinite loop

I have a custom step::
{
id: 'fe_tag',
component: ,
replace: false,
waitAction: true,
asMessage: true,

        },

And I have inside FeTag component
this.props.triggerNextStep({trigger: val});

However now my ChatBot ends up in a loop. This seems only to happen if I use the props replace: false. With replace: true it seems ok.
However I want to show the output of the component FeTag depending on the user choise, xo I need replace to be false.

Am I overlooking something or how to use this.props.triggerNextStep({trigger: val}); inside a custom component?

Activity

  1. pascalgagneur commented on Oct 4, 2019

    @pascalgagneur
    Contributor

    What is the value of 'val'

    this.props.triggerNextStep({trigger: val});
    

    Could you post an example?

  2. LucasBassetti commented on Sep 26, 2026

    @LucasBassetti
    Owner

    This is fixed in #392: each step now triggers the next one only once and clears its timer when it unmounts. React 18 StrictMode mounted every step twice, which doubled the messages at each step, and custom components calling triggerNextStep more than once (or double clicks on options) had the same effect.

    It will be part of the next release. Closing, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions