botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
68 stars 83 forks source link

My single choice response options disappear in the UI!! Help! #503

Closed thenilaymodi closed 5 years ago

thenilaymodi commented 5 years ago

Using Botpress 10.5 and web channel.

My response options to a single choice question disappear sometimes. It tends to happen after multiple page refreshes etc. In some cases it just start this way. Hard browser refreshes seem to be correlated with the response options disappearing. I have detailed my code setup below.

I'm calling a proactive action. Inside my index.js I have this. It jumps to a Flow.

bp.hear({ type: /proactive-trigger/i }, async (event, next) => {
      await bp.dialogEngine.jumpTo(event.sessionId || event.user.id, 'question.flow.json');
      await bp.dialogEngine.processMessage(event.sessionId || event.user.id, event);
      next();
 })

Inside the flow I'm just calling a custom action (actions.js) called askQuestion

async function askQuestion(state, event){

    const question = "Do you like it?";
    const choices = [
        {
          "title": "Yes",
          "value": "Yes"
        },
        {
          "title": "Sometimes",
          "value": "Sometimes"
        },
        {
          "title": "No",
          "value": "No"
        }
    ];

    await event.reply('#builtin_single-choice', { text: question, choices: choices, typing: true })

    return{
        ...state
    }
}

Any ideas why this is happening? Is this a bug?

thenilaymodi commented 5 years ago

This happens because I wasn't resetting my state before asking questions.

JonnyClean commented 11 months ago

Another issue that can cause this is when the question is left blank. It will allow you to save it but the choice options only display in the test dialog, not when deployed.