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
Router: update history package to 5.3.0, fix query string generation #60271
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +103 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well in the site editor and command palette.
The code looks good - nice cleanup.
🚀
function push( params, state ) { | ||
const search = buildSearch( params ); | ||
const search = buildQueryString( params ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks even better and more readable now 👏
Folks need to run I should have only upgraded the package in this PR, and remove the |
…ordPress#60271) Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
Upgrades the
history
package (dependency of@wordpress/router
) from 5.1.0 to 5.3.0.It fixes a regression (fixed in 5.2.0) where the
push
/replace
methods didn't automatically add a?
prefix to thesearch
query string. If you were on a/foo
URL, then navigating withhistory.push( { search: 'a=b' } )
was supposed to go to/foo?a=b
, but it navigated to/fooa=b
instead.Now it works correctly and we don't need to add the
?
character manually. The behavior is now similar to the native browser API, wherewindow.location.search = 'a=b'
also adds?
automatically.