web-widget icon indicating copy to clipboard operation
web-widget copied to clipboard

Cannot read property 'map' of undefined

Open a-j-n opened this issue 5 years ago • 3 comments

hello , every time i'm try to run this ButtonTemplate

public function AskForMoreInfo()
    {
        $list = ButtonTemplate::create(__('bot.chose_one'))
            ->addButton(
                ElementButton::create(__('bot.anther_search'))
                    ->type('postback')
                    ->payload('search')
            )
            ->addButton(
                ElementButton::create(__('bot.next_aya'))
                    ->type('postback')
                    ->payload('next_aya')
            );
        $this->ask($list, function (Answer $answer) {
            $this->say($answer->getText());
        });
    }

i'm facing this Cannot read property 'map' of undefined (chat.js:1)

Screen Shot 2019-06-16 at 3 26 54 AM Screen Shot 2019-06-16 at 3 24 07 AM Screen Shot 2019-06-16 at 3 24 20 AM

a-j-n avatar Jun 16 '19 01:06 a-j-n

i found out if i have two ButtonTemplate at the same conversation only first one will work

a-j-n avatar Jun 26 '19 17:06 a-j-n

Have you had solution for that problem?

hnguyen303 avatar Oct 17 '19 03:10 hnguyen303

In my case, the problem occurred when I was trying to list buttons after clicking other conversation buttons. The problem was this line: https://github.com/botman/web-widget/blob/master/src/chat/messages/action.tsx#L30. As you can see, a new object is created and buttons are not passed to the messageHandler function.

walkoda avatar Sep 02 '20 13:09 walkoda