Skip to content

Commit

Permalink
correct values for replaceState
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDarsa committed Aug 5, 2024
1 parent b0b8a22 commit 1e5ab65
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/ResultsLimited/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const ResultsLimited = ({ limit, changeLimit, message, disableHandler }) => {
const handleChange = values => {
const limitValueParsed = parseInt(values.value);
if (!Number.isNaN(limitValueParsed) && changeLimit) {
history.pushState(null, '', window.location.href.split('?')[0] + '?limit=' + values.value);
const newUrl = `${window.location.pathname}?limit=${limitValueParsed}${window.location.hash}`;
history.replaceState({ ...history.state, as: newUrl, url: newUrl }, '', newUrl);
changeLimit(limitValueParsed === -1 ? null : limitValueParsed);
}
};
Expand Down

0 comments on commit 1e5ab65

Please sign in to comment.