BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

Directline webchat not working in React Strict Mode

Open SyedFayaz opened this issue 1 year ago • 4 comments

Is it an issue related to Adaptive Cards?

No

Is this an accessibility issue?

No

What version of Web Chat are you using?

Latest production

Which distribution are you using Web Chat from?

NPM

Which hosting environment does this issue primarily affect?

Web apps

Which browsers and platforms do the issue happened?

Browser: Edge (latest), Browser: Chrome (latest), Browser: Firefox (latest)

Which area does this issue affect?

Others or unrelated

What is the public URL for the website?

No response

Please describe the bug

Minimizable web chat example from samples is not working in React Strict Mode. conversations API is getting cancelled

React Version: 18.2.0 NodeJS: 18.19.1

Do you see any errors in console log?

No response

How to reproduce the issue?

  1. Navigate to samples of webchat from this repo
  2. Go to minimizable-webchat sample
  3. Add React Strict Mode
  4. Install the node modules and start the application
  5. You will see conversations API getting cancelled.

What do you expect?

Bot should start and conversations API should succeed.

NOTE: Bot works if React Strict Mode is removed.

What actually happened?

Bot shows "connecting..." and not starting. (Attached screenshot for the same)

Do you have any screenshots or recordings to repro the issue?

320514840-b686f10f-a35b-461b-8928-d73a141c7363

Adaptive Card JSON

No response

Additional context

No response

SyedFayaz avatar Apr 09 '24 05:04 SyedFayaz

I've also encountered this with a brand new project using react 18.2.66 as per the README, using bot framework 4.16.0

benferns avatar May 07 '24 06:05 benferns

Can also confirm that this is a problem with React 18.3.1 with bot framework 4.18.0

frrikk avatar Aug 28 '24 11:08 frrikk

Is there any update on this issue or workaround to solve it

QaisAlkhateeb avatar Dec 12 '24 07:12 QaisAlkhateeb

I also have this issue on a Next.js project (v14.2 and React v18.2). I tried with CRA too, CodeSandbox, Stackblitz, Vite... it just never works with strict mode, conversations request gets canceled. I'm actually glad I found this issue, at least I now know why. But to me it makes the ReactWebChat unusable, because disabling strict mode is not an option. Any updates on this ?

Alarid avatar Jan 22 '25 10:01 Alarid