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 (
@@ -81,7 +95,9 @@ export default function ProjectsPage() {
) : (
{projects.map((project) => (
-
+
))}
)}
diff --git a/app/(dashboard)/shot-status/ShotStatusClient.tsx b/app/(dashboard)/shot-status/ShotStatusClient.tsx
index 5961b8b..af3073d 100644
--- a/app/(dashboard)/shot-status/ShotStatusClient.tsx
+++ b/app/(dashboard)/shot-status/ShotStatusClient.tsx
@@ -71,6 +71,8 @@ interface ShotStatusClientProps {
canManage: boolean;
}
+const SCROLL_KEY = 'shot-status-scroll';
+
const STATUS_CONFIG: Record
= {
WAITING: { label: "Waiting", color: "bg-zinc-500/10 text-zinc-400 border-zinc-500/20", icon: Clock },
IN_PROGRESS: { label: "In Progress", color: "bg-blue-500/10 text-blue-400 border-blue-500/20", icon: Film },
@@ -341,6 +343,7 @@ function ShotTable({
sessionStorage.setItem(SCROLL_KEY, String(window.scrollY))}
>
{shot.shotCode}
@@ -399,6 +402,15 @@ export function ShotStatusClient({
const router = useRouter();
const { toast } = useToast();
+ // Restore scroll position when shots load
+ useEffect(() => {
+ const saved = sessionStorage.getItem(SCROLL_KEY);
+ if (saved) {
+ sessionStorage.removeItem(SCROLL_KEY);
+ requestAnimationFrame(() => window.scrollTo(0, parseInt(saved, 10)));
+ }
+ }, [shots]);
+
// Restore last selected project if no project is currently selected
useEffect(() => {
if (!selectedProjectId) {