From 4825604a52cbebe6a7623bb33c22a8fba6754a9c Mon Sep 17 00:00:00 2001 From: Arnaud Nelissen Date: Sat, 13 Jun 2026 16:16:51 +0200 Subject: [PATCH] fix(settings): move Section out of render to fix input focus loss Section defined inside the component was recreated as a new type on every keystroke, causing React to unmount/remount it and drop focus. Co-Authored-By: Claude Sonnet 4.6 --- src/app/(app)/settings/page.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/app/(app)/settings/page.tsx b/src/app/(app)/settings/page.tsx index af02ec6..1844fd9 100644 --- a/src/app/(app)/settings/page.tsx +++ b/src/app/(app)/settings/page.tsx @@ -2,11 +2,22 @@ import { useQuery, useQueryClient } from "@tanstack/react-query"; import { signOut } from "next-auth/react"; -import { useState, useEffect } from "react"; +import React, { useState, useEffect } from "react"; import { useBaby } from "@/contexts/baby-context"; import { getThresholds, saveThresholds, requestPermission } from "@/lib/notifications"; import { Copy, Check, Download, LogOut, Bell, Baby, Users, ChevronRight, FileText, Plus, Mail, Send } from "lucide-react"; +function Section({ title, children }: { title: string; children: React.ReactNode }) { + return ( +
+
+

{title}

+
+ {children} +
+ ); +} + interface Family { id: string; name: string; @@ -239,14 +250,6 @@ export default function SettingsPage() { setSavingPushover(false); } - const Section = ({ title, children }: { title: string; children: React.ReactNode }) => ( -
-
-

{title}

-
- {children} -
- ); return (