diff --git a/src/components/weather/WeatherCard.tsx b/src/components/weather/WeatherCard.tsx index 7ab0fce..95545c6 100644 --- a/src/components/weather/WeatherCard.tsx +++ b/src/components/weather/WeatherCard.tsx @@ -105,20 +105,22 @@ export const WeatherCard = memo(function WeatherCard({ const [fluxEmoji, setFluxEmoji] = useState(entry.fluxEmoji || null); const [valueCreationEmoji, setValueCreationEmoji] = useState(entry.valueCreationEmoji || null); - // Reset local state when entry props change (React-idiomatic pattern) + const isCurrentUser = entry.userId === currentUserId; + const canEditThis = canEdit && isCurrentUser; + + // Sync state when props change from SSE refresh. + // Notes are NOT synced for the current user's own entry — they may be mid-edit. if (entryVersion !== entry) { setEntryVersion(entry); - setNotes(entry.notes || ''); + if (!isCurrentUser) setNotes(entry.notes || ''); setPerformanceEmoji(entry.performanceEmoji || null); setMoralEmoji(entry.moralEmoji || null); setFluxEmoji(entry.fluxEmoji || null); setValueCreationEmoji(entry.valueCreationEmoji || null); } - const isCurrentUser = entry.userId === currentUserId; - const canEditThis = canEdit && isCurrentUser; - function handleEmojiChange( + axis: 'performance' | 'moral' | 'flux' | 'valueCreation', emoji: string | null ) {