-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
fix(SSR): 修复多级路由嵌套时,需要合并多级路由serverLoader的数据 & feature(SSR): 支持ssr降级,客户端兜底加载serverLoader数据 #11894
Conversation
feature(SSR): 支持ssr降级,客户端兜底加载serverLoader数据
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
feature(SSR): 支持ssr降级,客户端兜底加载serverLoader数据
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #11894 +/- ##
==========================================
- Coverage 28.89% 28.83% -0.07%
==========================================
Files 488 489 +1
Lines 14892 14930 +38
Branches 3538 3548 +10
==========================================
+ Hits 4303 4305 +2
- Misses 9829 9861 +32
- Partials 760 764 +4 ☔ View full report in Codecov by Sentry. |
feature(SSR): 支持ssr降级,客户端兜底加载serverLoader数据
降级时机问题我在测试过程中,发现这个失败降级貌似是个伪命题,如果没有 何时会发生没有 所以我认为降级是个伪命题,实际上不会发生没有 |
降级的思路是这样的: 比如SSR运行失败时,直接返回静态 <!DOCTYPE html><html><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" href="https://i.alipayobjects.com/common/favicon/favicon.ico">
<link rel="stylesheet" href="/umi.6aa72519.css">
</head>
<body>
<div id="root"></div>
<script src="/umi.59c66b4f.js" crossorigin="anonymous"></script>
</body></html> 在浏览器中会以SPA去运行React App。 当然最完美的降级不是去在浏览器中请求__serverLoader获取useServerLoaderData的数据,而是通过在浏览器中运行 exporrt 的 serverLoader() 去请求,但这样对umi的改动太大,同时要求serverLoader能运行在浏览器中,先搞一个简单版本的降级方案。 |
No description provided.