Skip to content

fix(motion): address route transition CodeRabbit follow-ups#49

Merged
gelbh merged 3 commits into
mainfrom
fix/motion-transition-coderabbit
Jul 13, 2026
Merged

fix(motion): address route transition CodeRabbit follow-ups#49
gelbh merged 3 commits into
mainfrom
fix/motion-transition-coderabbit

Conversation

@gelbh

@gelbh gelbh commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Dedupe in-flight transitions by full destination (path + search + hash), not normalized path only
  • Refresh active transition state on fast-path redirects; cancel stale reveal via generation guard
  • Remove dead _blank check in AppLink; use <output> for overlay status; exception-safe preload test spy

Test plan

  • resolveNavigateDestinationKey unit tests
  • Related Vitest green
  • CodeRabbit thread gate clear
  • CI green → merge → verify prod deploy

Summary by CodeRabbit

  • Bug Fixes
    • Improved route transition reliability during rapid navigation, preventing older transitions from overriding newer ones.
    • Ensured navigation destination tracking uses a stable key so repeated navigations deduplicate correctly.
    • Preserved query strings and hash fragments when building navigation destination keys.
    • Updated loading UI semantics to better reflect current loading state.
    • Adjusted link click transition handling for target="_blank".
  • Tests
    • Added coverage for destination key generation, including query strings, hashes, and object-based route inputs.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 18d3eef8-d8dc-4ab6-9533-be87840a0fb4

📥 Commits

Reviewing files that changed from the base of the PR and between 9adf495 and 50c73fd.

📒 Files selected for processing (2)
  • src/navigation/RouteTransitionContext.tsx
  • src/navigation/routeTransition.test.ts

Walkthrough

Navigation transitions now identify destinations with normalized path keys that retain query and hash values. Transition generations prevent stale navigation work from updating current state, while link handling and loading markup are simplified.

Changes

Navigation transitions

Layer / File(s) Summary
Canonical destination key
src/navigation/routePreloaders.ts, src/navigation/routeTransition.test.ts
Adds resolveNavigateDestinationKey to normalize paths while preserving search and hash components, with coverage for string and object targets.
Transition generation lifecycle
src/navigation/RouteTransitionContext.tsx, src/navigation/routeTransition.test.ts
Uses destination keys for transition tracking, captures reveal direction, and prevents older transitions from revealing or resetting current state.
Navigation interaction and loading presentation
src/components/navigation/AppLink.tsx, src/navigation/RouteTransitionOverlay.tsx
Removes the redundant _blank transition check and changes the loading wrapper from div to output while retaining busy and label attributes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AppLink
  participant RouteTransitionProvider
  participant RoutePreloaders
  participant Screen
  AppLink->>RouteTransitionProvider: beginTransition(to)
  RouteTransitionProvider->>RoutePreloaders: resolveNavigateDestinationKey(to)
  RouteTransitionProvider->>RoutePreloaders: preloadRoute(destination)
  RouteTransitionProvider->>Screen: navigate
  Screen-->>RouteTransitionProvider: screen ready
  RouteTransitionProvider->>RouteTransitionProvider: check transition generation
  RouteTransitionProvider->>Screen: reveal captured direction
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title mentions route transitions but is too generic and doesn't clearly state the main change. Rename it to something specific like 'fix route transition dedupe by full destination and generation guard'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description matches the template with Summary and Test plan sections and includes concrete bullets and test status.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/motion-transition-coderabbit

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/navigation/routeTransition.test.ts`:
- Around line 29-51: Add edge-case tests in the resolveNavigateDestinationKey
suite for an object destination containing only pathname, verifying omitted
search and hash default to empty strings, and for a PRESET_EDIT_PATH_RE-matching
pathname with query and hash, verifying normalization preserves the expected
deduplication key composition.

In `@src/navigation/RouteTransitionContext.tsx`:
- Around line 120-132: In the fast-path branch of the route transition handler,
guard the navigate(to, navigateOptions) call and phase reset with
transitionGenerationRef.current === myGeneration after preloadRoute completes.
Preserve the existing behavior only for the current transition, preventing stale
transitions from navigating or overwriting phase state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 585a978b-9458-4760-a200-7cd9233eb223

📥 Commits

Reviewing files that changed from the base of the PR and between 7213d8a and 9adf495.

📒 Files selected for processing (5)
  • src/components/navigation/AppLink.tsx
  • src/navigation/RouteTransitionContext.tsx
  • src/navigation/RouteTransitionOverlay.tsx
  • src/navigation/routePreloaders.ts
  • src/navigation/routeTransition.test.ts
💤 Files with no reviewable changes (1)
  • src/components/navigation/AppLink.tsx

Comment thread src/navigation/routeTransition.test.ts
Comment thread src/navigation/RouteTransitionContext.tsx
@gelbh gelbh merged commit bbd62dd into main Jul 13, 2026
7 checks passed
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.

1 participant