v6.23.0
v6.23.0 (Minor Release)
Status: Released
This is a new minor release of the @alextheman/components package. It introduces new features and other backwards-compatible changes that should require little to no refactoring. Please read the description of changes below.
Description of Changes
-
Create a new
useAbsoluteLocationhook for usage within nested routers.- Previously, if you used the regular
useLocationfrom Wouter inside a nested route, the returned location would be relative to the nested router. - With this new hook, it will ensure that the returned location is resolved relative to the application's root router.
- For example:
import { useAbsoluteLocation } from "@alextheman/components/v7"; import { useLocation, Route } from "wouter"; <Route path="/users" nest> <Route path="/profile"> {(() => { const [wouterLocation] = useLocation(); console.log(wouterLocation) // will log "/profile" const [absoluteLocation] = useAbsoluteLocation(); console.log(absoluteLocation); // will log "/users/profile" })()} </Route> </Route>
- The behaviour demonstrated by
useAbsoluteLocationtends to be less surprising and works better in cases where the same page may be rendered from different nested routing structures.
- Previously, if you used the regular
-
Fix highlighting in
NavigationBottom.- The
valueproperty in thenavItemsitem is now optional, and will default to thetoproperty for the value. - This will ensure that the item is highlighted if the current location matches the item's
toproperty. - This can be overriden if necessary by providing the
valueproperty, which will take precedence overto. However, this is optional and most use cases should leave this out.
- The
Additional Notes
- On a completely unrelated note, I feel like the tech debt in this package is slowly starting to build up a bit.
- As such, I would like to release v7 fairly soon. That version will make this whole Wouter setup the standard for the package.
- I won't do a feature-freeze just yet as I am still in the process of Lexicon work and may need to change some things as I go. However, I think, starting this Friday I'll be ready to prepare the v7 release of this package, so be ready for that.