mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-25 01:02:19 +00:00
Reset window position when backing to previous page
This commit is contained in:
parent
b9c27d53ad
commit
030ca2a4e3
1 changed files with 8 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
import React, { FunctionComponent, useEffect, useMemo } from "react";
|
||||
import React, { FunctionComponent, useMemo } from "react";
|
||||
import { Redirect, Route, Switch, useHistory } from "react-router-dom";
|
||||
import { useDidMount } from "rooks";
|
||||
import { useIsRadarrEnabled, useIsSonarrEnabled } from "../@redux/hooks/site";
|
||||
import BlacklistRouter from "../Blacklist/Router";
|
||||
import HistoryRouter from "../History/Router";
|
||||
|
@ -26,9 +27,12 @@ const Router: FunctionComponent<{ className?: string }> = ({ className }) => {
|
|||
|
||||
const history = useHistory();
|
||||
|
||||
useEffect(() => {
|
||||
ScrollToTop();
|
||||
}, [history.location]);
|
||||
useDidMount(() => {
|
||||
history.listen(() => {
|
||||
// This is a hack to make sure ScrollToTop will be triggered in the next frame (When everything are loaded)
|
||||
setTimeout(ScrollToTop);
|
||||
});
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
|
|
Loading…
Reference in a new issue