Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: memory location search hook #497

Open
wants to merge 2 commits into
base: v3
Choose a base branch
from

Conversation

mitulagr2
Copy link

Return searchHook from memoryLocation. This can be passed to Router.

fixes #447

Copy link

stackblitz bot commented Nov 14, 2024

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

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (48b63a9) to head (97f556a).

Additional details and impacted files
@@            Coverage Diff            @@
##                v3      #497   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            1         1           
=========================================
  Hits             1         1           
Flag Coverage Δ
?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tillprochaska
Copy link

Hi @mitulagr2, thanks for taking the time to fix this. I’m currently working on an app that makes heavy use of URL search parameters to encode/share UI state, so I’m quite interested in better testing support for the useSearch hook.

I’ve tested your changes and noticed a few issues:

  • The location hook includes the search string in the returned value. The default browser location hook returns the path only.
  • The search hook returns a single-valued array, whereas the browser location search hook returns a string.

I’ve tried to fix these issues here: https://github.com/tillprochaska/wouter/tree/memory-location-search-hook

@molefrog I’ve seen that this PR has been open for quite a while. Is there anything else I could help with to move this forward?

I saw that the recent release includes a new useSearchParams hook. It would probably be nice if the memory location implementation had support for that as well, but that could probably be added separately on top of these changes.

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.

Memory location does not include a search hook
2 participants