fix(dev): fix scroll to top on app first load
This commit is contained in:
parent
69576610c4
commit
ade416ff1b
|
@ -7,6 +7,10 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|||
|
||||
<!-- ## Unreleased -->
|
||||
|
||||
## 0.6.4 - 2021-11-10
|
||||
|
||||
- fix: fix scroll to top on app first load
|
||||
|
||||
## 0.6.3 - 2021-11-10
|
||||
|
||||
- fix: add trailing slash to user components glob
|
||||
|
|
|
@ -9,13 +9,16 @@ import {useServerState} from '../useServerState';
|
|||
* server state, which in turn fetches the correct server component.
|
||||
*/
|
||||
export function ServerStateRouter() {
|
||||
const {setServerState, pending} = useServerState() as ServerStateContextValue;
|
||||
const {setServerState, pending, serverState} =
|
||||
useServerState() as ServerStateContextValue;
|
||||
const [isNavigating, setIsNavigating] = useState(false);
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
setIsNavigating(true);
|
||||
setServerState('pathname', location.pathname);
|
||||
if (serverState.pathname !== location.pathname) {
|
||||
setIsNavigating(true);
|
||||
setServerState('pathname', location.pathname);
|
||||
}
|
||||
}, [location.pathname, setServerState]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Reference in a new issue