Skip to content

Conversation

@wotan-allfather
Copy link

This PR adds state support to memoryLocation, similar to how useBrowserLocation handles history.state. This allows passing down state in testing scenarios and in-memory routing.

Changes:

  • Add optional state parameter to memoryLocation options for initial state
  • Accept state option in navigate function to update current state
  • Add state getter property to access current state value
  • Add stateHook for subscribing to state changes in components
  • Reset state to initial value when reset() is called

The implementation follows the pattern suggested in issue #492 by @molefrog.

Closes #492

This PR adds state support to memoryLocation, similar to how useBrowserLocation
handles history.state. This allows passing down state in testing scenarios
and in-memory routing.

Changes:
- Add optional `state` parameter to memoryLocation options for initial state
- Accept `state` option in navigate function to update current state
- Add `state` getter property to access current state value
- Add `stateHook` for subscribing to state changes in components
- Reset state to initial value when `reset()` is called

The implementation follows the pattern suggested in issue molefrog#492 by @molefrog.

Closes molefrog#492
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

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.

Support passing down state in memoryLocation.

1 participant