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

chore(deps): bump wouter from 2.7.5 to 3.1.0 #316

Closed
wants to merge 1 commit into from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 18, 2024

Bumps wouter from 2.7.5 to 3.1.0.

Release notes

Sourced from wouter's releases.

Active links, hash location href, automatic ssrSearch

This release brings some small improvements:

  • Link can now accept a function in className for applying styles to currently active links. Read more #419
  • In SSR, search string can now be extracted directly from ssrPath, e.g. pass /home?a=b to ssrPath and it will pre-fill ssrSearch #420
  • Finally, after more than 2 years of waiting, links have proper href rendered when used with hash location. Before the fix, a link pointing to "/#users was rendered as <a href="/users" /> without a hash. This now can be controlled via an hrefs function defined on a router, but for built-in useHashLocation this is done automatically. See #421
  • Minor improvement: use flatMap() method to flat child element in a switch. Thanks to abjfdi. See #254

v3.0.0: Routing "all-inclusive"

Over the past four months, @​jeetiss and I (@​molefrog) have been working on the upcoming major release v3. We've carefully listened to your requests on features that you wanted to see in Wouter and used this feedback to design the new version’s architecture and API.

But everything comes with a cost, so now, the library is no longer 1.5Kb... it's 2.1Kb. But it's packed with tons of new features: nested routing, wildcard patterns, useSearch compatible with SSR, hash location, memory location, history state, useParams, more secure History patching, improved TypeScript types, and more! We have also improved tooling to make the development process faster and more bulletproof: replaced Jest with Vitest, added dozens of new test cases, improved the speed of type linting, and simplified the Preact build by introducing a monorepo.

Below are some breaking changes that we tried to provide a migration guide for. To start using wouter v3, simply install:

> npm i wouter@3.0.0

Nested routes

Previously, there was a hacky workaround to get nested routing working. You would have to manually inherit the router from the parent and customise the base path. This was far from ideal, and it only worked for static paths.

Now, nesting is a core feature of wouter and can be enabled on a route via the nest prop. When this prop is present, the route matches everything that starts with a given pattern and it creates a nested routing context. All child routes will receive location relative to that pattern. Let's take a look at this example:

<Route path="/app" nest>
  <Route path="/users/:id" nest>
    <Route path="/orders" />
  </Route>
</Route> 
  1. This first route will be active for all paths that start with /app, this is equivalent to having a base path in your app.
  2. The second one uses dynamic pattern to match paths like /app/user/1, /app/user/1/anything and so on.
  3. Finally, the inner-most route will only work for paths that look like /app/users/1/orders. The match is strict, since that route does not have a nest prop and it works as usual.

If you call useLocation() inside the last route, it will return /orders and not /app/users/1/orders. This creates a nice isolation and it makes it easier to make changes to parent route without worrying that the rest of the app will stop working. If you need to navigate to a top-level page however, you can use a prefix to refer to an absolute path:

<Route path="/payments" nest>
  <Route path="/all">
    <Link to="~/home">Back to Home</Link>
  </Route>
</Route> 

Native useSearch hook and history state support

useSearch hook is now part of the core. This means that you can import it from the main module, and will work with SSR too!

... (truncated)

Commits
  • f2e3b8d Release v3.1.0
  • 5cfa1c7 Document hrefs prop.
  • 62060a1 useHashLocation uses its own hrefs method.
  • c2d71c7 Allow links to have transformed hrefs.
  • 0a927eb Add types for hrefs option on Router.
  • 6815e69 Active links in the docs.
  • 4b204d4 Extend types to cover className function.
  • acaf4a7 Links can accept functions as className (active).
  • 1b56df8 Release v3.0.2
  • bd58607 feat: adds main entry to packages package.json
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot requested review from HamdyD, jmorel and a team as code owners March 18, 2024 19:46
@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Mar 18, 2024
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/wouter-3.1.0 branch 2 times, most recently from 75795c3 to 1c2288f Compare March 20, 2024 10:08
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/wouter-3.1.0 branch 2 times, most recently from 7a69385 to b7428a0 Compare March 27, 2024 16:07
Bumps [wouter](https://github.com/molefrog/wouter) from 2.7.5 to 3.1.0.
- [Release notes](https://github.com/molefrog/wouter/releases)
- [Commits](molefrog/wouter@v2.7.5...v3.1.0)

---
updated-dependencies:
- dependency-name: wouter
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/wouter-3.1.0 branch from b7428a0 to 6954e1f Compare April 2, 2024 09:30
Copy link
Contributor Author

dependabot bot commented on behalf of github Apr 8, 2024

Superseded by #330.

@dependabot dependabot bot closed this Apr 8, 2024
@dependabot dependabot bot deleted the dependabot/npm_and_yarn/wouter-3.1.0 branch April 8, 2024 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants