const history = createBrowserHistory({ basename: '/base' })
When the history gets the location from the URL, it will strip the basename off of the pathname.
if (basename)
path = stripPrefix(path, basename)
This means that a pathname without the basename is treated the same as a pathname with the basename.
"/base/my-page" == "/my-page"
It could be argued that this problem exists only when a user is improperly creating the history (you should only create a history with a basename when you are on a page with that basename), but at the very least I think that a warning would be helpful.
warning(
!(basename && pathname.indexOf(basename) !== 0),
"You are attempting to use a basename on a page whose URL has no basename."
)
Given a history with a basename:
When the history gets the location from the URL, it will strip the basename off of the pathname.
This means that a pathname without the basename is treated the same as a pathname with the basename.
It could be argued that this problem exists only when a user is improperly creating the
history
(you should only create a history with a basename when you are on a page with that basename), but at the very least I think that a warning would be helpful.