Skip to content

v6.23.0

Choose a tag to compare

@alex-up-bot alex-up-bot released this 18 May 22:53
· 120 commits to main since this release

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 useAbsoluteLocation hook for usage within nested routers.

    • Previously, if you used the regular useLocation from 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 useAbsoluteLocation tends to be less surprising and works better in cases where the same page may be rendered from different nested routing structures.
  • Fix highlighting in NavigationBottom.

    • The value property in the navItems item is now optional, and will default to the to property for the value.
    • This will ensure that the item is highlighted if the current location matches the item's to property.
    • This can be overriden if necessary by providing the value property, which will take precedence over to. However, this is optional and most use cases should leave this out.

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.