Skip to content

Conversation

@matfire
Copy link

@matfire matfire commented Oct 15, 2025

  • adds history dependency
  • syncs history with different operations
  • implements back method for MemoryRouter
  • adds tests

Partially based on #126
Closes #73

@changeset-bot
Copy link

changeset-bot bot commented Oct 15, 2025

⚠️ No Changeset found

Latest commit: e2d48f4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@matfire matfire marked this pull request as ready for review October 15, 2025 12:24
@scottrippey
Copy link
Owner

I'm excited to support this improvement! Looked through the code, and overall looks great.

However, I do have 1 concern. I don't like adding the history dependency, especially since it's not a heavily-used feature. (I haven't needed it for the 3 projects that I've used next-router-mock on).

I like how you're using setCurrentHistory to set the history object. Could we utilize this approach to just make history optional? And in the documentation, we'd have instructions like "to use history, install history and call setCurrentHistory(...)".

@scottrippey scottrippey added the needs more information More information is needed to investigate label Oct 28, 2025
@matfire
Copy link
Author

matfire commented Oct 29, 2025

Thanks for getting back to me!

Would moving history to either peerDependencies or optionalDependencies (more likely the first) and having guards for the back method so that it can't be called without history (and the internal history cannot be changed if it is not defined when navigating) be ok ?

@scottrippey
Copy link
Owner

Yeah that sounds good. Making history an optional feature keeps this library simple. It's similar to the dynamic segment feature: optional but easy to add.

@matfire
Copy link
Author

matfire commented Oct 29, 2025

got it, will push the changes asap

@matfire
Copy link
Author

matfire commented Nov 6, 2025

should be good to go, @scottrippey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs more information More information is needed to investigate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

router.back support

2 participants