fix: incorrect tab query in memory history #1829
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤔 这个变动的性质是?/ What is the nature of this change?
🔗 相关 Issue / Related Issue
无
💡 需求背景和解决方案 / Background or solution
修复在 MemoryHistory 场景下,页面 Tab 切换后 query 更新不正确的问题,这会导致
useLocation
拿到的search
值不正确,影响包含 TOC 链接地址在内的其他功能。原因是 MemoryHistory 的 push 方法不会自动对
params
参数加上?
前缀,与 BrowserHistory 的行为不一致,复现链接:https://codesandbox.io/s/quirky-fast-xgvcyy?file=/src/App.js解法是手动补上
?
前缀确保无论在 MemoryHistory 还是 BrowserHistory 下都可以工作。📝 更新日志 / Changelog