diff --git a/examples/hello-world/src/suspense/index.tsx b/examples/hello-world/src/suspense/index.tsx
index a4f5393..6ce2e81 100644
--- a/examples/hello-world/src/suspense/index.tsx
+++ b/examples/hello-world/src/suspense/index.tsx
@@ -1,4 +1,21 @@
-import {Suspense} from 'react'
+import {Suspense, use} from 'react'
+
+const delay = (t) =>
+ new Promise((r) => {
+ setTimeout(r, t)
+ })
+
+const cachePool: any[] = []
+
+function fetchData(id, timeout) {
+ const cache = cachePool[id]
+ if (cache) {
+ return cache
+ }
+ return (cachePool[id] = delay(timeout).then(() => {
+ return {data: Math.random().toFixed(2) * 100}
+ }))
+}
export default function App() {
return (
@@ -9,6 +26,7 @@ export default function App() {
}
function Child() {
- debugger
- throw new Promise((resolve) => setTimeout(resolve, 1000))
+ const {data} = use(fetchData(1, 1000))
+
+ return {data}
}
diff --git a/packages/react-reconciler/src/begin_work.rs b/packages/react-reconciler/src/begin_work.rs
index 4bad91e..aba2024 100644
--- a/packages/react-reconciler/src/begin_work.rs
+++ b/packages/react-reconciler/src/begin_work.rs
@@ -51,56 +51,48 @@ pub fn begin_work(
work_in_progress: Rc>,
render_lane: Lane,
) -> Result