Skip to content

Commit 3b31bb0

Browse files
authored
feat(expo,react): Make Signal hooks the default (#6946)
1 parent 8c47111 commit 3b31bb0

File tree

126 files changed

+116
-6553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+116
-6553
lines changed

.cursor/rules/monorepo.mdc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ Framework-Specific Packages
5050
- `@clerk/vue` - Vue.js composables and components
5151
- `@clerk/astro` - Astro integration with SSR support
5252
- `@clerk/nuxt` - Nuxt.js module
53-
- `@clerk/remix` - Remix loader and action utilities
5453
- `@clerk/express` - Express.js middleware
5554
- `@clerk/fastify` - Fastify plugin
5655
- `@clerk/expo` - React Native/Expo SDK

.github/labeler.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ react:
3939
react-router:
4040
- packages/react-router/**
4141

42-
remix:
43-
- packages/remix/**
44-
4542
tanstack:
4643
- packages/tanstack-react-start/**
4744

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
matrix:
210210
include:
211211
- node-version: 20
212-
test-filter: '--filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@clerk/nextjs --filter=@clerk/react --filter=@clerk/shared --filter=@clerk/remix --filter=@clerk/tanstack-react-start --filter=@clerk/elements --filter=@clerk/vue --filter=@clerk/nuxt --filter=@clerk/expo'
212+
test-filter: '--filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@clerk/nextjs --filter=@clerk/react --filter=@clerk/shared --filter=@clerk/tanstack-react-start --filter=@clerk/elements --filter=@clerk/vue --filter=@clerk/nuxt --filter=@clerk/expo'
213213
- node-version: 22
214214
test-filter: '**'
215215

.jit/config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ folders:
1717
- path: /packages/react
1818
exclude:
1919
- ./**/*.test.ts
20-
- path: /packages/remix
21-
exclude:
22-
- ./**/*.test.ts
2320
- path: /packages/shared
2421
exclude:
2522
- ./**/*.test.ts

.typedoc/__tests__/__snapshots__/file-structure.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ exports[`Typedoc output > should have a deliberate file structure 1`] = `
174174
"react/use-reverification.mdx",
175175
"react/use-session-list.mdx",
176176
"react/use-session.mdx",
177-
"react/use-sign-in-signal.mdx",
177+
"react/use-sign-in-1.mdx",
178178
"react/use-sign-in.mdx",
179-
"react/use-sign-up-signal.mdx",
179+
"react/use-sign-up-1.mdx",
180180
"react/use-sign-up.mdx",
181181
"react/use-user.mdx",
182182
"nextjs/auth.mdx",

integration/templates/custom-flows-react-vite/src/routes/SignIn.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ import { Button } from '@/components/ui/button';
55
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
66
import { Input } from '@/components/ui/input';
77
import { Label } from '@/components/ui/label';
8-
import { useUser } from '@clerk/react';
9-
import { useSignInSignal } from '@clerk/react/experimental';
8+
import { useSignIn, useUser } from '@clerk/react';
109
import { useState } from 'react';
1110
import { NavLink, useNavigate } from 'react-router';
1211

1312
type AvailableStrategy = 'email_code' | 'phone_code' | 'password' | 'reset_password_email_code';
1413

1514
export function SignIn({ className, ...props }: React.ComponentProps<'div'>) {
16-
const { signIn, errors, fetchStatus } = useSignInSignal();
15+
const { signIn, errors, fetchStatus } = useSignIn();
1716
const [selectedStrategy, setSelectedStrategy] = useState<AvailableStrategy | null>(null);
1817
const { isSignedIn } = useUser();
1918
const navigate = useNavigate();

integration/templates/custom-flows-react-vite/src/routes/SignUp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { Button } from '@/components/ui/button';
55
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
66
import { Input } from '@/components/ui/input';
77
import { Label } from '@/components/ui/label';
8-
import { useSignUpSignal } from '@clerk/react/experimental';
8+
import { useSignUp } from '@clerk/react';
99
import { NavLink, useNavigate } from 'react-router';
1010

1111
export function SignUp({ className, ...props }: React.ComponentProps<'div'>) {
12-
const { signUp, errors, fetchStatus } = useSignUpSignal();
12+
const { signUp, errors, fetchStatus } = useSignUp();
1313
const navigate = useNavigate();
1414

1515
const handleSubmit = async (formData: FormData) => {

integration/templates/expo-web/app/_layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default function RootLayout() {
88
<ClerkProvider
99
routerPush={(to: string) => router.push(to)}
1010
routerReplace={to => router.replace(to)}
11+
clerkJSUrl={process.env.EXPO_PUBLIC_CLERK_JS_URL}
1112
>
1213
<ClerkLoaded>
1314
<Stack>

integration/templates/expo-web/app/custom-sign-in.tsx

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,22 @@ import { Text, TextInput, Button, View } from 'react-native';
44
import React from 'react';
55

66
export default function Page() {
7-
const { signIn, setActive, isLoaded } = useSignIn();
7+
const { signIn } = useSignIn();
88
const router = useRouter();
99

1010
const [emailAddress, setEmailAddress] = React.useState('');
1111
const [password, setPassword] = React.useState('');
1212

1313
const onSignInPress = React.useCallback(async () => {
14-
if (!isLoaded) {
15-
return;
16-
}
17-
18-
try {
19-
const signInAttempt = await signIn.create({
20-
identifier: emailAddress,
21-
password,
14+
await signIn.password({ emailAddress, password });
15+
if (signIn.status === 'complete') {
16+
await signIn.finalize({
17+
navigate: async () => {
18+
router.replace('/');
19+
},
2220
});
23-
24-
if (signInAttempt.status === 'complete') {
25-
await setActive({ session: signInAttempt.createdSessionId });
26-
router.replace('/');
27-
} else {
28-
// See https://clerk.com/docs/custom-flows/error-handling
29-
// for more info on error handling
30-
console.error(JSON.stringify(signInAttempt, null, 2));
31-
}
32-
} catch (err: any) {
33-
console.error(JSON.stringify(err, null, 2));
3421
}
35-
}, [isLoaded, emailAddress, password]);
22+
}, [emailAddress, password]);
3623

3724
return (
3825
<View>

integration/templates/expo-web/app/custom-sign-up.tsx

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useSignUp } from '@clerk/expo';
44
import { useRouter } from 'expo-router';
55

66
export default function SignUpScreen() {
7-
const { isLoaded, signUp, setActive } = useSignUp();
7+
const { signUp } = useSignUp();
88
const router = useRouter();
99

1010
const [emailAddress, setEmailAddress] = React.useState('');
@@ -13,46 +13,19 @@ export default function SignUpScreen() {
1313
const [code, setCode] = React.useState('');
1414

1515
const onSignUpPress = async () => {
16-
if (!isLoaded) {
17-
return;
18-
}
19-
20-
try {
21-
await signUp.create({
22-
emailAddress,
23-
password,
24-
});
25-
26-
await signUp.prepareEmailAddressVerification({ strategy: 'email_code' });
27-
28-
setPendingVerification(true);
29-
} catch (err: any) {
30-
// See https://clerk.com/docs/custom-flows/error-handling
31-
// for more info on error handling
32-
console.error(JSON.stringify(err, null, 2));
33-
}
16+
await signUp.password({ emailAddress, password });
17+
await signUp.verifications.sendEmailCode({ emailAddress });
18+
setPendingVerification(true);
3419
};
3520

3621
const onPressVerify = async () => {
37-
if (!isLoaded) {
38-
return;
39-
}
40-
41-
try {
42-
const completeSignUp = await signUp.attemptEmailAddressVerification({
43-
code,
22+
await signUp.verifications.verifyEmailCode({ code });
23+
if (signUp.status === 'complete') {
24+
await signUp.finalize({
25+
navigate: async () => {
26+
router.replace('/');
27+
},
4428
});
45-
46-
if (completeSignUp.status === 'complete') {
47-
await setActive({ session: completeSignUp.createdSessionId });
48-
router.replace('/');
49-
} else {
50-
console.error(JSON.stringify(completeSignUp, null, 2));
51-
}
52-
} catch (err: any) {
53-
// See https://clerk.com/docs/custom-flows/error-handling
54-
// for more info on error handling
55-
console.error(JSON.stringify(err, null, 2));
5629
}
5730
};
5831

0 commit comments

Comments
 (0)