From 464812980d693b420a286ab986c1d2b7a3152fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20G=C3=B3mez?= Date: Wed, 15 Apr 2026 14:49:10 +0200 Subject: [PATCH] fix: sync NIP-5C me parameter with active account on login/logout Add useEffect to keep the me param field in sync with the active account pubkey. Clears on logout, updates on account switch. Skips updates while a scroll is actively running to avoid mid-execution changes. Closes #265 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/scroll/ScrollExecutor.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/scroll/ScrollExecutor.tsx b/src/components/scroll/ScrollExecutor.tsx index 6c39a12..4a5d792 100644 --- a/src/components/scroll/ScrollExecutor.tsx +++ b/src/components/scroll/ScrollExecutor.tsx @@ -57,6 +57,19 @@ export function ScrollExecutor({ params, wasmBase64 }: ScrollExecutorProps) { const isActive = runtimeState === "loading" || runtimeState === "running"; + // Sync "me" param with active account pubkey + useEffect(() => { + const hasMeParam = params.some( + (p) => p.name === "me" && p.type === "public_key", + ); + if (!hasMeParam || isActive) return; + + setParamValues((prev) => ({ + ...prev, + me: pubkey || "", + })); + }, [pubkey, params, isActive]); + // Sorted, deduplicated display events (newest first) const displayedEvents = useMemo( () =>