Skip to content

Conversation

@TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Oct 30, 2025

Continued from

This PR creates a SentryNuqsTestingAdapter that uses our useLocation and useNavigate hooks to interface with nuqs in tests so that it uses our testing router as the source of truth

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 30, 2025
@TkDodo TkDodo marked this pull request as ready for review October 30, 2025 11:48
@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #102387   +/-   ##
========================================
  Coverage   80.96%    80.96%           
========================================
  Files        8819      8819           
  Lines      390155    390155           
  Branches    24832     24832           
========================================
  Hits       315878    315878           
  Misses      73911     73911           
  Partials      366       366           

? `${location.pathname}${queryString}`
: location.pathname;

// The navigate function from TestRouter already wraps this in act()
Copy link
Member

Choose a reason for hiding this comment

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

this is surprisingly true

Comment on lines +45 to +48
// eslint-disable-next-line react-hooks/rules-of-hooks
const location = useLocation();
// eslint-disable-next-line react-hooks/rules-of-hooks
const navigate = useNavigate();
Copy link
Member

Choose a reason for hiding this comment

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

i think this area was most surprising to me after looking at the result of what was vibe coded

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah I tried moving it out but it didn’t work :/

I think it’s good enough like this, I’d appreciate a ✅ so we can merge it, as we already have PRs blocked by this 🙏

@TkDodo TkDodo merged commit ed0af59 into master Oct 30, 2025
45 checks passed
@TkDodo TkDodo deleted the tkdodo/fix/nuqs-testing-adapter branch October 30, 2025 19:58
shashjar pushed a commit that referenced this pull request Nov 4, 2025
Continued from
- #101616

This PR creates a `SentryNuqsTestingAdapter` that uses our `useLocation`
and `useNavigate` hooks to interface with nuqs in tests so that it uses
our testing router as the source of truth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants