Skip to content

Commit

Permalink
keep section param in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarlandian committed Jan 11, 2021
1 parent b33662f commit ab67d3e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ const SystemNarrativePage: React.FC<{
},
[isScrolling]
);
// keep section state in sync with URL if it changes externally (e.g. via nav link)
useEffect(() => {
directlySetActiveSection(Number(routeParams.sectionNumber) || 1);
}, [routeParams.sectionNumber]);

const [, setScrollSpring] = useSpring(() => ({
onFrame: (props: { top: number }) => window.scrollTo(0, props.top),
// set the flag while animation is in progress
Expand Down

0 comments on commit ab67d3e

Please sign in to comment.