-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
划词翻译会导致用了 react SSR(Server-side rendering) 的网站无法正常运行 #1689
Comments
This comment was marked as outdated.
This comment was marked as outdated.
已确认是由于划词翻译在 html 下插入了一个 div 导致使用了 Server-side rendering 的网站发现客户端和服务端 html 结构不一样导致的。 如果划词翻译延迟一段时间(比如一秒后)再将 div 插入 html 就不会有这个问题,但是这个插入的具体时机很难把握。。 |
以 https://radar.cloudflare.com/ 这个网站为例,经过多次测试,发现划词翻译最少需要在 100 毫秒后插入到 dom 才能确保不会报错,但我不确定在其他 Server-side rendering 的网站是不是也可以用 100 毫秒作为插入的时机。 |
remix中也有反馈,不止本插件有问题,但是除了关闭扩展,没有提到其他修复方案 |
使用 import { RemixBrowser } from "@remix-run/react";
import { startTransition, StrictMode } from "react";
+import { hydrate } from "react-dom";
import { hydrateRoot } from "react-dom/client";
startTransition(() => {
- hydrateRoot(
- document,
- <StrictMode>
- <RemixBrowser />
- </StrictMode>
- );
+ hydrate(<RemixBrowser />, document);
}); |
lmk123
changed the title
扩展好像会导致remix启动报错
划词翻译会导致用了 react SSR(Server-side rendering) 的网站无法正常运行
Mar 29, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
基本信息
划词翻译版本:
9.6.0
浏览器版本:
Microsoft Edge
版本 111.0.1661.51 (正式版本) (arm64)
操作系统:
MacOS
重现问题的步骤
预期行为
remix网站成功,且无报错
实际行为
报错
补充信息
The text was updated successfully, but these errors were encountered: