Skip to content

Commit

Permalink
Align machine ID with other steps
Browse files Browse the repository at this point in the history
  • Loading branch information
BRKalow committed Oct 11, 2024
1 parent 3aa6b57 commit 8d3279e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { ClerkElementsError, ClerkElementsRuntimeError } from '~/internals/error
import { ThirdPartyMachine, ThirdPartyMachineId } from '~/internals/machines/third-party';
import { shouldUseVirtualRouting } from '~/internals/machines/utils/next';

import { SignInStartMachineId } from '../sign-in';
import { SignUpContinueMachine } from './continue.machine';
import type {
SignUpRouterContext,
Expand Down Expand Up @@ -330,7 +329,7 @@ export const SignUpRouterMachine = setup({
tags: ['step:start'],
exit: 'clearFormErrors',
invoke: {
id: SignInStartMachineId,
id: 'start',
src: 'startMachine',
input: ({ context, self }) => ({
basePath: context.router?.basePath,
Expand All @@ -346,7 +345,7 @@ export const SignUpRouterMachine = setup({
'RESET.STEP': {
actions: enqueueActions(({ enqueue, context }) => {
enqueue('clearFormErrors');
enqueue.sendTo(SignInStartMachineId, { type: 'SET_FORM', formRef: context.formRef });
enqueue.sendTo('start', { type: 'SET_FORM', formRef: context.formRef });
}),
},
NEXT: [
Expand Down
13 changes: 6 additions & 7 deletions packages/elements/src/react/sign-up/context/router.context.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { ActorRefFrom, AnyActorRef, AnyStateMachine, SnapshotFrom } from 'xstate';

import { SignInStartMachineId } from '~/internals/machines/sign-in';
import type {
TSignUpContinueMachine,
TSignUpRouterMachine,
TSignUpStartMachine,
TSignUpVerificationMachine,
import {
type TSignUpContinueMachine,
type TSignUpRouterMachine,
type TSignUpStartMachine,
type TSignUpVerificationMachine,
} from '~/internals/machines/sign-up';
import { createContextFromActorRef } from '~/react/utils/create-context-from-actor-ref';

Expand All @@ -17,6 +16,6 @@ function useSignUpStep<M extends AnyStateMachine, T = ActorRefFrom<M>>(name: str
return SignUpRouterCtx.useSelector(state => state.children[name] as AnyActorRef) as T;
}

export const useSignUpStartStep = () => useSignUpStep<TSignUpStartMachine>(SignInStartMachineId);
export const useSignUpStartStep = () => useSignUpStep<TSignUpStartMachine>('start');
export const useSignUpContinueStep = () => useSignUpStep<TSignUpContinueMachine>('continue');
export const useSignUpVerificationStep = () => useSignUpStep<TSignUpVerificationMachine>('verification');

0 comments on commit 8d3279e

Please sign in to comment.