Live data from Hacker News

Everything about Google Translate crashing React (and other web apps)

martijnhols.nl

81–88 of 88 posts

Re: Everything about Google Translate crashing React (and other web apps)

#81
post #76

Earlier quoted context omitted.

The primary application is the browser. The problem here is that react "application" builds its own state of the web page, fails to reconcile it with changes to actual state, ends up in a detached state with stale information and then proceeds to alter actual state based on the corrupted information it has.

I disagree. The browser is a VM that runs other applications, in this case one that's written in React. Then the browser, via an extension, is corrupting that application's internal state and is then surprised when that application stops working correctly. Well, duh. If Translate were to only modify the text on the website, I'd think React would be able to deal with it better. But it seems to be modifying the structu…

I disagree with that. Fundamentally, it comes down to who is in charge. Does React control the DOM or does the DOM control react? I see this as a cache concurrency issue--React is trying to cache the DOM and breaking when that fails.

Re: Everything about Google Translate crashing React (and other web apps)

#82
post #3

So the fundamental problem is the DOM is too inefficient to do applications on it. No surprise there, considering the original design of HTML was for presenting information, not for interactive applications.

I doubt it. Say you write a native app and some other side app swoops in and changes all your UI state while running. That is going to cause problems.

Disagree. I've swooped in on programs and done major changes to their filesystem behind their back. Programs that had no concept of working with externally supplied data in a network world. The programs happily went along doing their job, completely unaware that every label was a phantom whose meaning would always change if selected. The contents were appropriate (everything was simple CSV), the proper commands would be sent to the attached machinery.

It's the responsibility of the swooper to ensure everything's put back sane.

Re: Everything about Google Translate crashing React (and other web apps)

#83
post #3

So the fundamental problem is the DOM is too inefficient to do applications on it. No surprise there, considering the original design of HTML was for presenting information, not for interactive applications.

No. It's not an issue with efficiency at all.

Re: Everything about Google Translate crashing React (and other web apps)

#84
The real fix is to have a new web feature which is to have the 'page dom' and the 'display dom',.

By default there would be a 1:1 mapping, but things like browser extensions could write code to define how a particular bit of page dom would display to the user.

Re: Everything about Google Translate crashing React (and other web apps)

#86

Earlier quoted context omitted.

> I will add, please make sure that language is an independent setting, and not derived from locale! Websites already have exactly what they need to provide you with the language you want via the Accept-Language header your browser sends. In your browser's settings you can configure a list of languages (country-specific if desired) which get send with every request. E.g.,: en-GB en nl (Prefer British English, fall ba…

This is not true. E.g., Safari is tied to the OS settings, Firefox has some dependencies regarding the locale of the first install, etc… Moreover, probably most people speak or can read more than a single language. There may be reasons for accessing a site in a particular language other than the standard locale. Please empower users to make their own choice! Do not assume to know better.

For example, when the translation is shit and you prefer to use the English one because the one in your language is impossible to understand.

Re: Everything about Google Translate crashing React (and other web apps)

#88
post #76

Earlier quoted context omitted.

The primary application is the browser. The problem here is that react "application" builds its own state of the web page, fails to reconcile it with changes to actual state, ends up in a detached state with stale information and then proceeds to alter actual state based on the corrupted information it has.

I disagree. The browser is a VM that runs other applications, in this case one that's written in React. Then the browser, via an extension, is corrupting that application's internal state and is then surprised when that application stops working correctly. Well, duh. If Translate were to only modify the text on the website, I'd think React would be able to deal with it better. But it seems to be modifying the structu…

The browser extension is not touching "application's" state whatsoever. The browser extension is, however, making a perfectly legal store on a shared system resource (if you consider browser to be VM), but the application ignores those modifications and continues to issue state modification calls computed from it's own, now long invalidated, internal cache.

> I think it's not reasonable to expect every JS framework to be able to deal with that properly.

It would be unreasonable to call any framework out of pre-alpha prototype stage, much less production ready, if it can't handle such basic stuff, sorry.

Post reply on HN