diff --git a/exercises/04.router/05.problem.cache/ui/index.js b/exercises/04.router/05.problem.cache/ui/index.js index d198c70..35c6052 100644 --- a/exercises/04.router/05.problem.cache/ui/index.js +++ b/exercises/04.router/05.problem.cache/ui/index.js @@ -61,6 +61,7 @@ function Root() { // 🐨 change this to setContentKey(historyKey) startTransition(() => setContentPromise(nextContentPromise)) + // 🐨 otherwise, setContentKey(historyKey) directly (no transition needed) } window.addEventListener('popstate', handlePopState) return () => window.removeEventListener('popstate', handlePopState) diff --git a/exercises/04.router/05.solution.cache/ui/index.js b/exercises/04.router/05.solution.cache/ui/index.js index 86d7077..5b5cb1a 100644 --- a/exercises/04.router/05.solution.cache/ui/index.js +++ b/exercises/04.router/05.solution.cache/ui/index.js @@ -56,9 +56,10 @@ function Root() { const fetchPromise = fetchContent(nextLocation) const nextContentPromise = createFromFetch(fetchPromise) contentCache.set(historyKey, nextContentPromise) + startTransition(() => setContentKey(historyKey)) + } else { + setContentKey(historyKey) } - - startTransition(() => setContentKey(historyKey)) } window.addEventListener('popstate', handlePopState) return () => window.removeEventListener('popstate', handlePopState)