fix: convert Map to Record for server-client boundary, remove dead currentUser prop

- WeatherBoard: change previousEntries type from Map<string, PreviousEntry> to Record<string, PreviousEntry> and update lookup from .get() to bracket notation
- page.tsx: wrap previousEntries with Object.fromEntries() before passing as prop, remove unused currentUser prop
- WeatherCard: remove spurious eslint-disable-next-line comment for non-existent rule react-hooks/set-state-in-effect

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 17:12:46 +01:00
parent 3e869bf8ad
commit 51bc187374
3 changed files with 3 additions and 14 deletions

View File

@@ -93,11 +93,6 @@ export default async function WeatherSessionPage({ params }: WeatherSessionPageP
<WeatherBoard <WeatherBoard
sessionId={session.id} sessionId={session.id}
currentUserId={authSession.user.id} currentUserId={authSession.user.id}
currentUser={{
id: authSession.user.id,
name: authSession.user.name ?? null,
email: authSession.user.email ?? '',
}}
entries={session.entries} entries={session.entries}
shares={session.shares} shares={session.shares}
owner={{ owner={{
@@ -106,7 +101,7 @@ export default async function WeatherSessionPage({ params }: WeatherSessionPageP
email: session.user.email ?? '', email: session.user.email ?? '',
}} }}
canEdit={session.canEdit} canEdit={session.canEdit}
previousEntries={previousEntries} previousEntries={Object.fromEntries(previousEntries)}
/> />
</WeatherLiveWrapper> </WeatherLiveWrapper>
</main> </main>

View File

@@ -38,11 +38,6 @@ type PreviousEntry = {
interface WeatherBoardProps { interface WeatherBoardProps {
sessionId: string; sessionId: string;
currentUserId: string; currentUserId: string;
currentUser: {
id: string;
name: string | null;
email: string;
};
entries: WeatherEntry[]; entries: WeatherEntry[];
shares: Share[]; shares: Share[];
owner: { owner: {
@@ -51,7 +46,7 @@ interface WeatherBoardProps {
email: string; email: string;
}; };
canEdit: boolean; canEdit: boolean;
previousEntries: Map<string, PreviousEntry>; previousEntries: Record<string, PreviousEntry>;
} }
export function WeatherBoard({ export function WeatherBoard({
@@ -146,7 +141,7 @@ export function WeatherBoard({
currentUserId={currentUserId} currentUserId={currentUserId}
entry={entry} entry={entry}
canEdit={canEdit} canEdit={canEdit}
previousEntry={previousEntries.get(entry.userId) ?? null} previousEntry={previousEntries[entry.userId] ?? null}
/> />
))} ))}
</tbody> </tbody>

View File

@@ -69,7 +69,6 @@ export function WeatherCard({ sessionId, currentUserId, entry, canEdit, previous
// Sync local state with props when they change (e.g., from SSE refresh) // Sync local state with props when they change (e.g., from SSE refresh)
useEffect(() => { useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setNotes(entry.notes || ''); setNotes(entry.notes || '');
setPerformanceEmoji(entry.performanceEmoji || null); setPerformanceEmoji(entry.performanceEmoji || null);
setMoralEmoji(entry.moralEmoji || null); setMoralEmoji(entry.moralEmoji || null);