mirror of
https://github.com/zhigang1992/server-components-demo.git
synced 2026-04-30 10:32:55 +08:00
Co-authored-by: Dan Abramov <dan.abramov@me.com> Co-authored-by: Sebastian Markbåge <sema@fb.com> Co-authored-by: Joseph Savona <josephsavona@users.noreply.github.com> Co-authored-by: Andrew Clark <git@andrewclark.io>
33 lines
1.0 KiB
HTML
33 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="description" content="React with Server Components demo">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<link rel="stylesheet" href="style.css" />
|
|
<title>React Notes</title>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
<script>
|
|
// In development, we restart the server on every edit.
|
|
// For the purposes of this demo, retry fetch automatically.
|
|
let nativeFetch = window.fetch;
|
|
window.fetch = async function fetchWithRetry(...args) {
|
|
for (let i = 0; i < 4; i++) {
|
|
try {
|
|
return await nativeFetch(...args);
|
|
} catch (e) {
|
|
if (args[1] && args[1].method !== 'GET') {
|
|
// Don't retry mutations to avoid confusion
|
|
throw e;
|
|
}
|
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
}
|
|
}
|
|
return nativeFetch(...args);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|