Demonstrates "removeChild" and "insertBefore" bugs with Weglot when used with React.
This simple application uses vite to transform and serve the react code.
- Run
npm install - Run
npm run dev - Open
http://localhost:5173in your browser
- Open your locally served application, or visit https://brianpeiris.github.io/weglot-bug
- The application is in English by default.
- Click on the "Toggle frog" button change the end of the sentence.
- Click on the "Toggle animal" button to hide the end of the sentence.
- Refresh the page.
- Switch to French using the language switcher in the bottom right corner.
- Click on the "Toggle frog" button and see the error in the console.
- Refresh the page.
- While still in French, click on the "Toggle animal" button and see the error in the console.
The Weglot support team has provided a solution to the original bug. As seen in src/Spans.jsx, the solution is to wrap text in span nodes so that they aren't just disconnected text nodes that may cause a mismatch in the DOM manipulation.
The solution is hosted at https://brianpeiris.github.io/weglot-bug/?spans