Remove scrolling behavior
Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
@@ -43,7 +43,6 @@ describe('SearchContext', () => {
|
||||
beforeEach(() => {
|
||||
query.mockResolvedValue({});
|
||||
(useApi as jest.Mock).mockReturnValue({ query: query });
|
||||
window.scrollTo = jest.fn();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
||||
@@ -93,11 +93,9 @@ export const SearchContextProvider = ({
|
||||
!result.loading && !result.error && result.value?.previousPageCursor;
|
||||
const fetchNextPage = useCallback(() => {
|
||||
setPageCursor(result.value?.nextPageCursor);
|
||||
resetScrollPosition();
|
||||
}, [result.value?.nextPageCursor]);
|
||||
const fetchPreviousPage = useCallback(() => {
|
||||
setPageCursor(result.value?.previousPageCursor);
|
||||
resetScrollPosition();
|
||||
}, [result.value?.previousPageCursor]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -131,7 +129,3 @@ export const useSearch = () => {
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
||||
function resetScrollPosition() {
|
||||
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user