Skip to content

Commit

Permalink
not update scroll on same pathname
Browse files Browse the repository at this point in the history
  • Loading branch information
peteranny committed Sep 17, 2024
1 parent 3d9d0f2 commit 72d8016
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { hydrate } from 'react-dom';
import { createBrowserHistory as createHistory } from 'history';
import R from 'ramda';
import qs from 'qs';
import { Provider } from 'react-redux';
import { Router } from 'react-router-dom';
import { ScrollContext } from 'react-router-scroll-4';
Expand All @@ -12,7 +13,13 @@ import Root from './components/Root';
import configureStore from './store/configureStore';

function shouldUpdateScroll(prevProps, props) {
const mapSearch = ({ search, ...rest }) => {
let s = qs.parse(search, { ignoreQueryPrefix: true });
s = R.omit(['q'], s); // We don't reset scroll on search query change
return { search: s, ...rest };
};
const getSignature = R.compose(
mapSearch,
R.omit(['state', 'key']),
R.path(['location']),
);
Expand Down

0 comments on commit 72d8016

Please sign in to comment.