Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

wouter

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wouter - npm Package Compare versions

Comparing version
3.8.0
to
3.8.1
+1
-1
package.json
{
"name": "wouter",
"version": "3.8.0",
"version": "3.8.1",
"description": "Minimalist-friendly ~1.5KB router for React",

@@ -5,0 +5,0 @@ "type": "module",

@@ -149,5 +149,8 @@ import { parse as parsePattern } from "regexparam";

// when `ssrPath` contains a `?` character, we can extract the search from it
const [path, search] = props.ssrPath?.split("?") ?? [];
if (search) (props.ssrSearch = search), (props.ssrPath = path);
// when `ssrPath` contains a `?` character, we can extract the search from it.
// also, ensure ssrSearch is always defined when ssrPath is provided, so that
// useSearch behavior matches usePathname (proper SSR hydration when client
// renders <Router> without props after server rendered with ssrPath/ssrSearch)
const [path, search = props.ssrSearch ?? ""] = props.ssrPath?.split("?") ?? [];
if (path) props.ssrSearch = search, props.ssrPath = path;

@@ -178,4 +181,4 @@ // hooks can define their own `href` formatter (e.g. for hash location)

? /* base is special case, it is appended to the parent's base */
parent[k] + (props[k] || "")
: props[k] || parent[k];
parent[k] + (props[k] ?? "")
: props[k] ?? parent[k];

@@ -182,0 +185,0 @@ if (prev === next && option !== next[k]) {

@@ -36,2 +36,5 @@ import { useSyncExternalStore } from "./react-deps.js";

currentSearch,
// != null checks for both null and undefined, but allows empty string ""
// This allows proper hydration: server renders with ssrSearch="?foo",
// client hydrates with just <Router /> and reads from location.search
ssrSearch != null ? () => ssrSearch : currentSearch

@@ -45,2 +48,5 @@ );

currentPathname,
// != null checks for both null and undefined, but allows empty string ""
// This allows proper hydration: server renders with ssrPath="/foo",
// client hydrates with just <Router /> and reads from location.pathname
ssrPath != null ? () => ssrPath : currentPathname

@@ -47,0 +53,0 @@ );