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

v3: memory location #358

Merged
merged 16 commits into from
Oct 11, 2023
Merged

v3: memory location #358

merged 16 commits into from
Oct 11, 2023

Conversation

jeetiss
Copy link
Collaborator

@jeetiss jeetiss commented Oct 9, 2023

implement #355


  • preact
  • types
  • more tests
  • migrate existing tests to new memory location hook
  • size limit

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

size-limit report 📦

Path Size
packages/wouter/esm/index.js 1.43 KB (0%)
packages/wouter/esm/use-browser-location.js 694 B (0%)
packages/wouter-preact/esm/index.js 976 B (0%)
packages/wouter-preact/esm/use-browser-location.js 255 B (0%)
packages/wouter/esm/memory-location.js 566 B (+100% 🔺)
packages/wouter-preact/esm/memory-location.js 86 B (+100% 🔺)

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b77e710) 100.00% compared to head (1a343e6) 100.00%.

❗ Current head 1a343e6 differs from pull request most recent head 2429b6e. Consider uploading reports for the commit 2429b6e to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##                v3      #358   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           11        11           
  Branches         3         3           
=========================================
  Hits            11        11           

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

@jeetiss jeetiss requested a review from molefrog October 10, 2023 08:40
@jeetiss jeetiss marked this pull request as ready for review October 10, 2023 08:40
packages/wouter/src/memory-location.js Outdated Show resolved Hide resolved
packages/wouter/test/memory-location.test-d.ts Outdated Show resolved Hide resolved
packages/wouter/test/memory-location.test.ts Outdated Show resolved Hide resolved
packages/wouter/test/memory-location.test.ts Show resolved Hide resolved
packages/wouter/test/redirect.test.tsx Show resolved Hide resolved
const useMemoryLocation = ({ base } = {}) => {
const location = useSyncExternalStore(subscribe, () => currentPath);

return [relativePath(base, location), navigate];
Copy link
Owner

Choose a reason for hiding this comment

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

I suppose navigate method should transform the path provided using absolutePath similarly to browser location. How to reproduce:

  1. Use base path "/app", initial path "/app/users". The value returned from the hook is "/users".
  2. Navigate to "/settings", the path is "/settings" (with current setup it will be "~/settings"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ready!

Copy link
Owner

@molefrog molefrog left a comment

Choose a reason for hiding this comment

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

🍾

@jeetiss jeetiss merged commit 367b5d9 into v3 Oct 11, 2023
3 checks passed
@jeetiss jeetiss deleted the memory-location branch October 11, 2023 09:38
@molefrog molefrog mentioned this pull request Oct 11, 2023
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.

None yet

2 participants