A few days ago while testing the checkout flow, I was getting "Your cart is empty." text on the cart. But there were items in it.
Other times I got "Something went wrong!" right in the middle of checkout. The reports all came from phones, so it looked like a mobile bug ...
The real clue was a tiny Google Translate icon in the address bar.
Some background: This is an online ordering system for restaurants in Germany. The ordering pages are in German. If your phone is in English, Chrome asks "Translate this page?" and plenty of people tap yes.
What Chrome does next is the problem. It doesn't edit the text. It swaps the text nodes React rendered for its own tags, and React has no idea. It still holds the old nodes.
So when React later updates that spot (the customer switches the mode to pickup from delivery, or the address "Find Location" button shows its spinner), it calls removeChild or insertBefore with a node that isn't on the page anymore. The browser throws NotFoundError and the error boundary replaces the whole checkout with "Something went wrong!".
The empty cart is the quiet version of the same thing. React keeps updating the old text node, which nobody can see anymore, so the customer keeps looking at the old translated label.
React's own GitHub issue for this was opened in 2017. In 2018 the React team said they can't fix it inside React without hiding real bugs or slowing every app down, and posted a workaround instead.
What I shipped:
A small guard on removeChild and insertBefore. If the node is already gone, skip the remove, or append instead of insert. Every valid call goes straight to the browser.
Text that changes while you're on the page (cart count, totals, button labels) is keyed by its own value, so React replaces the whole element and Chrome translates the new one.
A correct on every page. It said "de" everywhere, English pages included.
Plus a unit test that does to the DOM what Translate does, and reproduces the crash before the fix.
If you ship React to people who don't all read your page's language, try this: open your app in Chrome, right-click, "Translate to English", and click through your checkout. Takes two minutes.
Has translate ever broken something of yours? Curious how others deal with it.


