From 1e5ab6559fe2e8a40c2cd1e1341f891fa120582c Mon Sep 17 00:00:00 2001 From: Davit Date: Mon, 5 Aug 2024 12:50:47 +0400 Subject: [PATCH] correct values for replaceState --- src/components/ResultsLimited/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/ResultsLimited/index.js b/src/components/ResultsLimited/index.js index 2b8f9f11..73e642ce 100644 --- a/src/components/ResultsLimited/index.js +++ b/src/components/ResultsLimited/index.js @@ -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); } };