fix: notes patching in weather
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m58s

This commit is contained in:
2026-03-03 11:18:11 +01:00
parent 8de4c1985f
commit c3b653601c

View File

@@ -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
) {