From 1a77a82566609dc24f9f3c61d46d625f069976dc Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Fri, 19 Jun 2026 12:58:47 +0200 Subject: [PATCH] scroll positions remembered --- app/(dashboard)/projects/page.tsx | 20 +++++++++++++++++-- .../shot-status/ShotStatusClient.tsx | 12 +++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/(dashboard)/projects/page.tsx b/app/(dashboard)/projects/page.tsx index ccd49fc..4db701e 100644 --- a/app/(dashboard)/projects/page.tsx +++ b/app/(dashboard)/projects/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState } from "react"; +import { useState, useEffect } from "react"; import { useQuery } from "@tanstack/react-query"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; @@ -35,6 +35,20 @@ export default function ProjectsPage() { const projects = data?.projects ?? []; const clients = clientsData?.clients ?? []; + const SCROLL_KEY = 'projects-scroll'; + + useEffect(() => { + if (!isLoading) { + const saved = sessionStorage.getItem(SCROLL_KEY); + if (saved) { + sessionStorage.removeItem(SCROLL_KEY); + requestAnimationFrame(() => window.scrollTo(0, parseInt(saved, 10))); + } + } + }, [isLoading]); + + const saveScroll = () => sessionStorage.setItem(SCROLL_KEY, String(window.scrollY)); + return (