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

[Bug]: No default location set in <StaticRouter> #8243

Closed
birdofpreyru opened this issue Nov 5, 2021 · 1 comment
Closed

[Bug]: No default location set in <StaticRouter> #8243

birdofpreyru opened this issue Nov 5, 2021 · 1 comment
Labels

Comments

@birdofpreyru
Copy link

According to docs:

<StaticRouter location> defaults to "/"

In the actual implementation if location is undefined the code arrives to the line 26 and crashes on the attempt to read pathname of undefined object:

export function StaticRouter({
basename,
children,
location: locationProp
}: StaticRouterProps) {
if (typeof locationProp === "string") {
locationProp = parsePath(locationProp);
}
let action = Action.Pop;
let location: Location = {
pathname: locationProp.pathname || "/",
search: locationProp.search || "",
hash: locationProp.hash || "",
state: locationProp.state || null,
key: locationProp.key || "default"
};

@timdorr timdorr added the bug label Nov 5, 2021
@timdorr timdorr changed the title No default location set in <StaticRouter> [Bug]: No default location set in <StaticRouter> Nov 5, 2021
@mjackson
Copy link
Member

mjackson commented Nov 5, 2021

This was released in 6.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants