question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Messages duplicate

See original GitHub issue

Describe the bug Messages are doubled with each new trigger.

To Reproduce Steps to reproduce the behavior:

  1. clean install the repo inside a fresh react app.
  2. use the code example below.

Expected behavior messages should appear only once, as defined in the code. Instead, they appear multiple times (see screenshot)

Desktop (please complete the following information):

  • OS: Mac OS Monterey
  • Browser Latest Chrome, Safari

Bildschirmfoto 2022-06-28 um 15 51 27

Code

import "./App.css";
import ChatBot from "react-simple-chatbot";

function App() {
  const steps = [
    {
      id: "0",
      message: "Message 0",
      trigger: "1",
    },
    {
      id: "1",
      message: "Message 1",
      trigger: "2",
    },
    {
      id: "2",
      message: "Message 2",
      end: true,
    },
  ];

  return (
    <div className="App">
      <ChatBot steps={steps} />
    </div>
  );
}

export default App;

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

10reactions
Esshahncommented, Jul 7, 2022

I’ve investigated more an found the difference that made it work for me. Before I used:

import ReactDOM from "react-dom/client";
ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
)

which produced the error, switching it to

import { render } from "react-dom";
render(<App />, document.getElementById("root"));

made it work. Hope that helps.

1reaction
Eduardo-Miguelcommented, Nov 26, 2022

I’ve investigated more an found the difference that made it work for me. Before I used:

import ReactDOM from "react-dom/client";
ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
)

which produced the error, switching it to

import { render } from "react-dom";
render(<App />, document.getElementById("root"));

made it work. Hope that helps.

This worked for me thanks!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Stop Sending Duplicate Text Messages on Android
A variety of problems can cause duplicate messages on Android and this article will teach you how to fix that from happening.
Read more >
Why did the person I sent a message to get duplicate ...
If you find duplicate messages sent within a few seconds of each other. This means that Twilio sent multiple messages to the carrier,...
Read more >
6 Ways to Solve Receiving Duplicate Text Messages Samsung
Method 1: Force Restart Samsung ... Perhaps the duplicate text message keeps re-occurring, try as much as possible to restart your Samsung device....
Read more >
Android sending double or duplicate text messages? You're ...
Some Android users are reporting that their phones are sending double or duplicate text messages and here are some workarounds for the ...
Read more >
Duplicate text messages - Apple Support Communities
I have an iPhone and I'm receiving a duplicate from an Android user. This isn't a carrier issue. They show only a single...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found