mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-04 01:31:11 +02:00
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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(
|
||||
() =>
|
||||
|
||||
Reference in New Issue
Block a user