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

View File

@@ -38,11 +38,6 @@ type PreviousEntry = {
interface WeatherBoardProps {
sessionId: string;
currentUserId: string;
currentUser: {
id: string;
name: string | null;
email: string;
};
entries: WeatherEntry[];
shares: Share[];
owner: {
@@ -51,7 +46,7 @@ interface WeatherBoardProps {
email: string;
};
canEdit: boolean;
previousEntries: Map<string, PreviousEntry>;
previousEntries: Record<string, PreviousEntry>;
}
export function WeatherBoard({
@@ -146,7 +141,7 @@ export function WeatherBoard({
currentUserId={currentUserId}
entry={entry}
canEdit={canEdit}
previousEntry={previousEntries.get(entry.userId) ?? null}
previousEntry={previousEntries[entry.userId] ?? null}
/>
))}
</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)
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setNotes(entry.notes || '');
setPerformanceEmoji(entry.performanceEmoji || null);
setMoralEmoji(entry.moralEmoji || null);