File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
exercises/04.router/05.problem.cache/ui Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -54,12 +54,13 @@ function Root() {
54
54
setNextLocation ( nextLocation )
55
55
// 🐨 get the historyKey from window.history.state?.key (or fallback to a new one with generateKey)
56
56
57
- // 🐨 if the contentCache does not have an entry for the historyKey, then trigger this update:
57
+ // 🐨 if the contentCache has an entry for the historyKey, then setContentKey(historyKey) directly.
58
+ // (⚠️ no startTransition needed here because the content is already available).
59
+ // 🐨 otherwise, fetch new content and wrap the update in startTransition:
58
60
const fetchPromise = fetchContent ( nextLocation )
59
61
const nextContentPromise = createFromFetch ( fetchPromise )
60
62
// 🐨 use the historyKey to add the nextContentPromise in the contentCache
61
-
62
- // 🐨 change this to setContentKey(historyKey)
63
+ // 🐨 and change this to setContentKey(historyKey)
63
64
startTransition ( ( ) => setContentPromise ( nextContentPromise ) )
64
65
}
65
66
window . addEventListener ( 'popstate' , handlePopState )
You can’t perform that action at this time.
0 commit comments