fix: notes patching in weather
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m58s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m58s
This commit is contained in:
@@ -105,20 +105,22 @@ export const WeatherCard = memo(function WeatherCard({
|
|||||||
const [fluxEmoji, setFluxEmoji] = useState(entry.fluxEmoji || null);
|
const [fluxEmoji, setFluxEmoji] = useState(entry.fluxEmoji || null);
|
||||||
const [valueCreationEmoji, setValueCreationEmoji] = useState(entry.valueCreationEmoji || 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) {
|
if (entryVersion !== entry) {
|
||||||
setEntryVersion(entry);
|
setEntryVersion(entry);
|
||||||
setNotes(entry.notes || '');
|
if (!isCurrentUser) setNotes(entry.notes || '');
|
||||||
setPerformanceEmoji(entry.performanceEmoji || null);
|
setPerformanceEmoji(entry.performanceEmoji || null);
|
||||||
setMoralEmoji(entry.moralEmoji || null);
|
setMoralEmoji(entry.moralEmoji || null);
|
||||||
setFluxEmoji(entry.fluxEmoji || null);
|
setFluxEmoji(entry.fluxEmoji || null);
|
||||||
setValueCreationEmoji(entry.valueCreationEmoji || null);
|
setValueCreationEmoji(entry.valueCreationEmoji || null);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isCurrentUser = entry.userId === currentUserId;
|
|
||||||
const canEditThis = canEdit && isCurrentUser;
|
|
||||||
|
|
||||||
function handleEmojiChange(
|
function handleEmojiChange(
|
||||||
|
|
||||||
axis: 'performance' | 'moral' | 'flux' | 'valueCreation',
|
axis: 'performance' | 'moral' | 'flux' | 'valueCreation',
|
||||||
emoji: string | null
|
emoji: string | null
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user