This commit is contained in:
@@ -14,9 +14,12 @@ type Phase = 'form' | 'logging-in' | 'saving' | 'done' | 'error';
|
||||
interface Props {
|
||||
existingProfile?: BrowserSessionProfile | null;
|
||||
onClose: () => void;
|
||||
/** When set, the profile is created under this space (`?spaceId=…`) and the
|
||||
* space-scoped react-query key is invalidated on save. Omit for personal. */
|
||||
spaceId?: string;
|
||||
}
|
||||
|
||||
export function AddBrowserSessionDialog({ existingProfile, onClose }: Props) {
|
||||
export function AddBrowserSessionDialog({ existingProfile, onClose, spaceId }: Props) {
|
||||
const { t } = useTranslation('userfolder');
|
||||
const qc = useQueryClient();
|
||||
const [phase, setPhase] = useState<Phase>('form');
|
||||
@@ -42,7 +45,7 @@ export function AddBrowserSessionDialog({ existingProfile, onClose }: Props) {
|
||||
storageOrigins: [new URL(startUrl).origin],
|
||||
loggedInSelector: loggedInSelector || undefined,
|
||||
loginUrlPatterns: loginUrl ? [loginUrl] : [],
|
||||
});
|
||||
}, spaceId);
|
||||
pid = created.id;
|
||||
setProfileId(pid);
|
||||
}
|
||||
@@ -62,6 +65,7 @@ export function AddBrowserSessionDialog({ existingProfile, onClose }: Props) {
|
||||
try {
|
||||
await saveBrowserSession(profileId, sessionId);
|
||||
qc.invalidateQueries({ queryKey: ['browser-session-profiles'] });
|
||||
if (spaceId) qc.invalidateQueries({ queryKey: ['space-browser-sessions', spaceId] });
|
||||
setPhase('done');
|
||||
setTimeout(onClose, 800);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user