Skip to content

Commit f359a82

Browse files
feat: upgrade ReactQuery to v5 (obytes#316)
1 parent 4ebce64 commit f359a82

File tree

9 files changed

+46
-59
lines changed

9 files changed

+46
-59
lines changed

docs/src/content/docs/guides/data-fetching.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Exactly the same way we did in [form section](../ui-and-theme/Forms.mdx) while c
122122
1. Create the schema for the new form using Zod
123123
2. Create the form using react-hook-form
124124
3. Get `mutate` function from `useAddPost` hook and call it when the form is submitted
125-
4. You can use the `isLoading` state to display a loading indicator while the data is being sent to the server and then redirect the user to the feed screen on success.
125+
4. You can use the `isPending` state to display a loading indicator while the data is being sent to the server and then redirect the user to the feed screen on success.
126126

127127
<CodeBlock file="src/app/feed/add-post.tsx" />
128128

ios/ObytesApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@
366366
);
367367
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
368368
PRODUCT_BUNDLE_IDENTIFIER = com.obytes.development;
369-
PRODUCT_NAME = "ObytesApp";
369+
PRODUCT_NAME = ObytesApp;
370370
SWIFT_OBJC_BRIDGING_HEADER = "ObytesApp/ObytesApp-Bridging-Header.h";
371371
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
372372
SWIFT_VERSION = 5.0;
@@ -394,7 +394,7 @@
394394
);
395395
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
396396
PRODUCT_BUNDLE_IDENTIFIER = com.obytes.development;
397-
PRODUCT_NAME = "ObytesApp";
397+
PRODUCT_NAME = ObytesApp;
398398
SWIFT_OBJC_BRIDGING_HEADER = "ObytesApp/ObytesApp-Bridging-Header.h";
399399
SWIFT_VERSION = 5.0;
400400
TARGETED_DEVICE_FAMILY = "1,2";

ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,8 +1559,8 @@ SPEC CHECKSUMS:
15591559
SDWebImageSVGCoder: 15a300a97ec1c8ac958f009c02220ac0402e936c
15601560
SDWebImageWebPCoder: af09429398d99d524cae2fe00f6f0f6e491ed102
15611561
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
1562-
Yoga: d17d2cc8105eed528474683b42e2ea310e1daf61
1562+
Yoga: 805bf71192903b20fc14babe48080582fee65a80
15631563

15641564
PODFILE CHECKSUM: ac55d8c0b92af1b0a5da5f8cb8448313ecc7948e
15651565

1566-
COCOAPODS: 1.12.1
1566+
COCOAPODS: 1.15.2

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@react-navigation/native": "^6.1.9",
4545
"@react-navigation/native-stack": "^6.9.17",
4646
"@shopify/flash-list": "1.6.3",
47-
"@tanstack/react-query": "^4.36.1",
47+
"@tanstack/react-query": "^5.32.1",
4848
"app-icon-badge": "^0.0.15",
4949
"axios": "^1.6.5",
5050
"expo": "~50.0.17",
@@ -79,7 +79,7 @@
7979
"react-native-screens": "~3.29.0",
8080
"react-native-svg": "14.1.0",
8181
"react-native-web": "~0.19.10",
82-
"react-query-kit": "^3.2.0",
82+
"react-query-kit": "^3.2.2",
8383
"tailwind-variants": "^0.1.20",
8484
"zod": "^3.22.4",
8585
"zustand": "^4.5.0"
@@ -88,8 +88,8 @@
8888
"@babel/core": "^7.23.7",
8989
"@commitlint/cli": "^17.8.1",
9090
"@commitlint/config-conventional": "^17.8.1",
91-
"@dev-plugins/react-navigation": "^0.0.5",
92-
"@dev-plugins/react-query": "^0.0.5",
91+
"@dev-plugins/react-navigation": "^0.0.6",
92+
"@dev-plugins/react-query": "^0.0.6",
9393
"@expo/config": "~8.5.4",
9494
"@react-native-community/eslint-config": "^3.2.0",
9595
"@testing-library/jest-dom": "^5.17.0",

pnpm-lock.yaml

Lines changed: 29 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/common/utils.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ export function getUrlParameters(
4141
}
4242

4343
export const getPreviousPageParam: GetNextPageParamFunction<
44+
unknown,
4445
PaginateQuery<unknown>
4546
> = (page) => getUrlParameters(page.previous)?.offset ?? null;
4647

4748
export const getNextPageParam: GetPreviousPageParamFunction<
49+
unknown,
4850
PaginateQuery<unknown>
4951
> = (page) => getUrlParameters(page.next)?.offset ?? null;

src/app/(app)/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Card } from '@/components/card';
77
import { EmptyList, FocusAwareStatusBar, Text, View } from '@/ui';
88

99
export default function Feed() {
10-
const { data, isLoading, isError } = usePosts();
10+
const { data, isPending, isError } = usePosts();
1111
const renderItem = React.useCallback(
1212
({ item }: { item: Post }) => <Card {...item} />,
1313
[]
@@ -27,7 +27,7 @@ export default function Feed() {
2727
data={data}
2828
renderItem={renderItem}
2929
keyExtractor={(_, index) => `item-${index}`}
30-
ListEmptyComponent={<EmptyList isLoading={isLoading} />}
30+
ListEmptyComponent={<EmptyList isLoading={isPending} />}
3131
estimatedItemSize={300}
3232
/>
3333
</View>

src/app/feed/[id].tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { ActivityIndicator, FocusAwareStatusBar, Text, View } from '@/ui';
77
export default function Post() {
88
const local = useLocalSearchParams<{ id: string }>();
99

10-
const { data, isLoading, isError } = usePost({
10+
const { data, isPending, isError } = usePost({
1111
//@ts-ignore
1212
variables: { id: local.id },
1313
});
1414

15-
if (isLoading) {
15+
if (isPending) {
1616
return (
1717
<View className="flex-1 justify-center p-3">
1818
<Stack.Screen options={{ title: 'Post', headerBackTitle: 'Feed' }} />

src/app/feed/add-post.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function AddPost() {
1919
const { control, handleSubmit } = useForm<FormType>({
2020
resolver: zodResolver(schema),
2121
});
22-
const { mutate: addPost, isLoading } = useAddPost();
22+
const { mutate: addPost, isPending } = useAddPost();
2323

2424
const onSubmit = (data: FormType) => {
2525
console.log(data);
@@ -64,7 +64,7 @@ export default function AddPost() {
6464
/>
6565
<Button
6666
label="Add Post"
67-
loading={isLoading}
67+
loading={isPending}
6868
onPress={handleSubmit(onSubmit)}
6969
testID="add-post-button"
7070
/>

0 commit comments

Comments
 (0)