feat: implement Year Review feature with session management, item categorization, and real-time collaboration
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6m7s

This commit is contained in:
Julien Froidefond
2025-12-16 08:55:13 +01:00
parent 48ff86fb5f
commit 56a9c2c3be
21 changed files with 2480 additions and 50 deletions

View File

@@ -18,6 +18,7 @@ export function EditableMotivatorTitle({
const [title, setTitle] = useState(initialTitle);
const [isPending, startTransition] = useTransition();
const inputRef = useRef<HTMLInputElement>(null);
const prevInitialTitleRef = useRef(initialTitle);
useEffect(() => {
if (isEditing && inputRef.current) {
@@ -26,9 +27,14 @@ export function EditableMotivatorTitle({
}
}, [isEditing]);
// Update local state when prop changes (e.g., from SSE)
// Update local state when prop changes (e.g., from SSE) - only when not editing
// This is a valid pattern for syncing external state (SSE updates) with local state
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
if (!isEditing) {
if (!isEditing && prevInitialTitleRef.current !== initialTitle) {
prevInitialTitleRef.current = initialTitle;
// Synchronizing with external prop updates (e.g., from SSE)
// eslint-disable-next-line react-hooks/exhaustive-deps
setTitle(initialTitle);
}
}, [initialTitle, isEditing]);