atmosphere explorer pds.ls
tool typescript atproto

fix permission prompt unmount

handle.invalid 0e47a105 bc785b74

verified
+11 -3
+11 -3
src/components/permission-prompt.tsx
··· 1 - import { createSignal } from "solid-js"; 1 + import { createEffect, createSignal } from "solid-js"; 2 2 import { GRANULAR_SCOPES } from "../auth/scope-utils"; 3 3 import { agent, setOpenManager, setPendingPermissionEdit } from "../auth/state"; 4 4 import { Button } from "./button"; ··· 13 13 }; 14 14 15 15 export const PermissionPromptContainer = () => { 16 + const [displayedScope, setDisplayedScope] = createSignal<ScopeId | null>(null); 17 + 18 + createEffect(() => { 19 + const scope = requestedScope(); 20 + if (scope !== null) setDisplayedScope(scope); 21 + }); 22 + 16 23 const scopeLabel = () => { 17 - const scope = GRANULAR_SCOPES.find((s) => s.id === requestedScope()); 18 - return scope?.label.toLowerCase() || requestedScope(); 24 + const scope = GRANULAR_SCOPES.find((s) => s.id === displayedScope()); 25 + return scope?.label.toLowerCase() || displayedScope(); 19 26 }; 20 27 21 28 const handleEditPermissions = () => { ··· 30 37 <Modal 31 38 open={requestedScope() !== null} 32 39 onClose={() => setRequestedScope(null)} 40 + onClosed={() => setDisplayedScope(null)} 33 41 contentClass="dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto w-[calc(100%-2rem)] max-w-md rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md dark:border-neutral-700" 34 42 > 35 43 <h2 class="mb-2 font-semibold">Permission required</h2>