Skip to content

Commit 4d065ff

Browse files
ray-oxdfatbird
authored andcommitted
DBC22-1612: restored scroll position logic
1 parent ec64e29 commit 4d065ff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/frontend/src/pages/CamerasListPage.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ export default function CamerasListPage() {
3636
const [processedCameras, setProcessedCameras] = useState(null);
3737

3838
// UseEffect hooks and data functions
39+
useEffect(() => {
40+
const scrollPosition = sessionStorage.getItem('scrollPosition');
41+
if (scrollPosition) {
42+
window.scrollTo(0, parseInt(scrollPosition, 10));
43+
}
44+
});
45+
3946
const getCamerasData = async () => {
4047
isInitialMount.current = false;
4148

@@ -75,11 +82,6 @@ export default function CamerasListPage() {
7582
if (selectedRoute && selectedRoute.routeFound) {
7683
setRouteEdit(false);
7784
}
78-
79-
// const scrollPosition = sessionStorage.getItem('scrollPosition');
80-
// if (scrollPosition) {
81-
// window.scrollTo(0, parseInt(scrollPosition, 10));
82-
// }
8385
}, [selectedRoute]);
8486

8587
return (

0 commit comments

Comments
 (0)