mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix(onboarding): prevent duplicate notifier providers and guard Continue button
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
fa5307c875
commit
b34267ae19
@@ -26,10 +26,13 @@ export const StepNotifier = () => {
|
|||||||
const { next, updateContext, state } = useOnboarding();
|
const { next, updateContext, state } = useOnboarding();
|
||||||
const [phase, setPhase] = useState<Phase>({ kind: "grid" });
|
const [phase, setPhase] = useState<Phase>({ kind: "grid" });
|
||||||
const [channels, setChannels] = useState<OnboardingChannel[]>([]);
|
const [channels, setChannels] = useState<OnboardingChannel[]>([]);
|
||||||
|
const [pending, setPending] = useState(false);
|
||||||
|
|
||||||
const form = useZodForm({ schema: NotificationChannelFormSchema });
|
const form = useZodForm({ schema: NotificationChannelFormSchema });
|
||||||
|
|
||||||
const startConfiguring = (provider: string) => {
|
const startConfiguring = (provider: string) => {
|
||||||
|
// Don't allow re-configuring a provider that's already been added
|
||||||
|
if (channels.some((c) => c.provider === provider)) return;
|
||||||
form.reset({ provider, enabled: true, name: "", config: {} } as any);
|
form.reset({ provider, enabled: true, name: "", config: {} } as any);
|
||||||
setPhase({ kind: "configuring", provider });
|
setPhase({ kind: "configuring", provider });
|
||||||
};
|
};
|
||||||
@@ -39,6 +42,7 @@ export const StepNotifier = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onContinue = async () => {
|
const onContinue = async () => {
|
||||||
|
setPending(true);
|
||||||
await updateContext({ flowData: { ...state?.context.flowData, notifiers: channels } });
|
await updateContext({ flowData: { ...state?.context.flowData, notifiers: channels } });
|
||||||
await next();
|
await next();
|
||||||
};
|
};
|
||||||
@@ -194,7 +198,7 @@ export const StepNotifier = () => {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button type="button" onClick={onContinue}>
|
<Button type="button" onClick={onContinue} disabled={pending}>
|
||||||
Continue
|
Continue
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user