substra-frontend
substra-frontend copied to clipboard
chore(deps): bump wouter from 2.7.5 to 3.1.2
Bumps wouter from 2.7.5 to 3.1.2.
Release notes
Sourced from wouter's releases.
Active links, hash location
href
, automaticssrSearch
This release brings some small improvements:
Link
can now accept a function inclassName
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
tossrPath
and it will pre-fillssrSearch
#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 anhrefs
function defined on a router, but for built-inuseHashLocation
this is done automatically. See #421- Minor improvement: use
flatMap()
method to flat child element in a switch. Thanks to abjfdi. See #254v3.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 [email protected]
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>
- This first route will be active for all paths that start with
/app
, this is equivalent to having a base path in your app.- The second one uses dynamic pattern to match paths like
/app/user/1
,/app/user/1/anything
and so on.- 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 anest
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
cf9ba61
v3.1.2c79d1f4
Fix compilation error on React < 181d577e1
Bump vite from 4.5.2 to 4.5.38cee71d
Create FUNDING.yml93f9dba
Publish a bugfix for Preact types.5efe317
Fix: add nest prop to Preact types, in line with React typesf2e3b8d
Release v3.1.05cfa1c7
Documenthrefs
prop.62060a1
useHashLocation
uses its ownhrefs
method.c2d71c7
Allow links to have transformed hrefs.- Additional commits viewable in compare view
You can trigger a rebase of this PR 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)
Note Automatic rebases have been disabled on this pull request as it has been open for over 30 days.