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

createPath no longer prefixes "search" and "hash" parameters #813

Open
panta82 opened this issue Jul 7, 2020 · 1 comment
Open

createPath no longer prefixes "search" and "hash" parameters #813

panta82 opened this issue Jul 7, 2020 · 1 comment

Comments

@panta82
Copy link

panta82 commented Jul 7, 2020

During the transition to typescript, createPath function has changed from this:

function createPath(location) {
  var pathname = location.pathname,
      search = location.search,
      hash = location.hash;
  var path = pathname || '/';
  if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
  if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
  return path;
}

to this

export function createPath({
  pathname = '/',
  search = '',
  hash = ''
}: PartialPath) {
  return pathname + search + hash;
}

You are no longer ensuring that passed search and hash are prefixed, which kind of broke our site.

You should either restore the old behavior or document the breaking change.

@panta82 panta82 changed the title createPath changed the way it treats "search" createPath no longer prefixed "search" and "hash" parameters Jul 7, 2020
@panta82 panta82 changed the title createPath no longer prefixed "search" and "hash" parameters createPath no longer prefixes "search" and "hash" parameters Jul 7, 2020
@chaance
Copy link
Contributor

chaance commented Aug 16, 2021

Added to the Breaking Changes section in our v5 release notes. Thank you for flagging this, very sorry for the breakage! https://github.com/remix-run/history/releases/tag/v5.0.0

EDIT: Jk, we actually should just revert this here and consider the change a bug. So that's what I'm going to do!

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

Successfully merging a pull request may close this issue.

2 participants