Skip to content

Remove unused isPending from RouterContext#28

Closed
kentcdodds wants to merge 3 commits into
mainfrom
fix/remove-unused-router-is-pending
Closed

Remove unused isPending from RouterContext#28
kentcdodds wants to merge 3 commits into
mainfrom
fix/remove-unused-router-is-pending

Conversation

@kentcdodds
Copy link
Copy Markdown
Member

@kentcdodds kentcdodds commented May 19, 2026

Fixes #27

Summary

  • Stop passing isPending from useTransition into RouterContext across router and actions exercises
  • Use const [, startTransition] = useTransition() since only startTransition is needed
  • Update the pending-ui exercise README and learner comments to describe comparing location and nextLocation instead

Test plan

  • Pending UI still works in exercises that compare location vs nextLocation (e.g. ship search, ship details)
  • Navigation still uses startTransition for content updates

Made with Cursor


Note

Low Risk
Low risk: removes an unused context value and adjusts useTransition destructuring without changing navigation or transition behavior.

Overview
Removes isPending from the RouterContext value across multiple router/actions exercises, since these modules only rely on startTransition and track pending UI via location vs nextLocation.

Updates each affected Root component to destructure useTransition() as const [, startTransition] = useTransition() and stops passing isPending through context.

Reviewed by Cursor Bugbot for commit 2b3e81c. Bugbot is set up for automated code reviews on this repo. Configure here.

kentcdodds and others added 3 commits May 19, 2026 09:39
Pending UI is derived by comparing location and nextLocation, so
isPending from useTransition was never read from context. Drop it
from context values, use a discarded binding for useTransition, and
update the pending-ui exercise notes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep isPending in RouterContext and combine it with location vs
nextLocation comparisons so pending states only show during an
active transition. Update the pending-ui exercise notes accordingly.

Fixes #27

Co-authored-by: Cursor <cursoragent@cursor.com>
Drop isPending from RouterContext in exercises after the pending-ui
step, where pending state is derived from location vs nextLocation.
Leave the pending-ui exercise unchanged.

Fixes #27

Co-authored-by: Cursor <cursoragent@cursor.com>
@kentcdodds kentcdodds closed this May 19, 2026
@kentcdodds kentcdodds deleted the fix/remove-unused-router-is-pending branch May 19, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unused isPending in RouterContext

1 participant