Skip to content

Commit fe88fe0

Browse files
committed
bump spacecraft to react-query 5
1 parent c2a4e84 commit fe88fe0

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

hackathon/spacecraft/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@react-navigation/bottom-tabs": "^6.5.5",
3232
"@react-navigation/native": "^6.1.1",
3333
"@react-navigation/native-stack": "^6.9.7",
34-
"@tanstack/react-query": "^4.29.12",
34+
"@tanstack/react-query": "^5.13.4",
3535
"babel-core": "^7.0.0-bridge.0",
3636
"babel-jest": "^29.5.0",
3737
"deepmerge": "^4.3.1",
@@ -67,7 +67,7 @@
6767
"@storybook/core-common": "^6.5.16",
6868
"@storybook/react-native": "^6.5.1",
6969
"@storybook/react-native-server": "^6.5.1",
70-
"@tanstack/eslint-plugin-query": "^4.29.9",
70+
"@tanstack/eslint-plugin-query": "^5.12.1",
7171
"@testing-library/jest-native": "^5.4.3",
7272
"@testing-library/react-native": "^12.1.2",
7373
"@types/jest": "^29.5.4",

hackathon/spacecraft/src/hooks/usePilot.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from "react";
2-
import { useQuery } from "@tanstack/react-query";
2+
import { keepPreviousData, useQuery } from "@tanstack/react-query";
33

44
export const usePilot = () => {
55
const [page, setPage] = useState(1);
@@ -9,8 +9,10 @@ export const usePilot = () => {
99
(result) => result.json()
1010
);
1111

12-
const query = useQuery(["pilots", page], () => fetchData(page), {
13-
keepPreviousData: true,
12+
const query = useQuery({
13+
queryKey: ["pilots", page],
14+
queryFn: () => fetchData(page),
15+
placeholderData: keepPreviousData,
1416
});
1517

1618
return { query, setPage, page };

hackathon/spacecraft/src/screens/StarshipFeedScreen.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ const renderItem = (props: RenderItemProps) => {
2727
};
2828

2929
export const StarshipFeedScreen = () => {
30-
const { isInitialLoading, isError, data, refetch } = useQuery(
31-
["starships"],
32-
fetchStarships
33-
);
30+
const { isLoading, isError, data, refetch } = useQuery({
31+
queryKey: ["starships"],
32+
queryFn: fetchStarships,
33+
});
3434

35-
if (isInitialLoading) {
35+
if (isLoading) {
3636
return <ScreenContainer title="Loading…" />;
3737
}
3838

hackathon/spacecraft/yarn.lock

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3360,23 +3360,24 @@
33603360
regenerator-runtime "^0.13.7"
33613361
resolve-from "^5.0.0"
33623362

3363-
"@tanstack/eslint-plugin-query@^4.29.9":
3364-
version "4.36.1"
3365-
resolved "https://registry.yarnpkg.com/@tanstack/eslint-plugin-query/-/eslint-plugin-query-4.36.1.tgz#dfae878104193a0ed1c2afdbea091048e1211d5e"
3366-
integrity sha512-qFIYV/BuwWzg0t5mSRMcb+rzrOVtCO9EizYxeClFxuFq/c54cNhAQCnDrA3iCxFz/fqRv7I9rxxnR/ZWkX15cQ==
3363+
"@tanstack/eslint-plugin-query@^5.12.1":
3364+
version "5.12.1"
3365+
resolved "https://registry.yarnpkg.com/@tanstack/eslint-plugin-query/-/eslint-plugin-query-5.12.1.tgz#4fd1804d32b4378471ad60eec1669745c41d0927"
3366+
integrity sha512-FuG/mN9cUO8KlT7KJzl8Yiw55uyXz1vzxXfoMnBbgiH8vk5WtUbEMdFeDF4ujgO+VSKR10uDdZ1+TIOpHhDUfQ==
3367+
dependencies:
3368+
"@typescript-eslint/utils" "^5.54.0"
33673369

3368-
"@tanstack/query-core@4.36.1":
3369-
version "4.36.1"
3370-
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-4.36.1.tgz#79f8c1a539d47c83104210be2388813a7af2e524"
3371-
integrity sha512-DJSilV5+ytBP1FbFcEJovv4rnnm/CokuVvrBEtW/Va9DvuJ3HksbXUJEpI0aV1KtuL4ZoO9AVE6PyNLzF7tLeA==
3370+
"@tanstack/query-core@5.13.4":
3371+
version "5.13.4"
3372+
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.13.4.tgz#50ecd3f721dfb0859528fbb8863268bee24145f0"
3373+
integrity sha512-8+rJucXvC/xlr4OrxHhEIob/cTlbT4fgmz1VsvB0D12FRStKaXeLORNGcOhSAynRd2NL74SV/Qq0IIb4DedLcA==
33723374

3373-
"@tanstack/react-query@^4.29.12":
3374-
version "4.36.1"
3375-
resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-4.36.1.tgz#acb589fab4085060e2e78013164868c9c785e5d2"
3376-
integrity sha512-y7ySVHFyyQblPl3J3eQBWpXZkliroki3ARnBKsdJchlgt7yJLRDUcf4B8soufgiYt3pEQIkBWBx1N9/ZPIeUWw==
3375+
"@tanstack/react-query@^5.13.4":
3376+
version "5.13.4"
3377+
resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.13.4.tgz#1a2b93a7319f3abd13461b5c5c7cf4eac369f567"
3378+
integrity sha512-3HjvkFFriEQwffUXtKHPiwkfFXUGbs46YATTzzyK1+Pw6Ekd3kwzS50e45qdamWuEXmXxyo5S1zp534LdFG0Rw==
33773379
dependencies:
3378-
"@tanstack/query-core" "4.36.1"
3379-
use-sync-external-store "^1.2.0"
3380+
"@tanstack/query-core" "5.13.4"
33803381

33813382
"@testing-library/jest-native@^5.4.3":
33823383
version "5.4.3"
@@ -3852,7 +3853,7 @@
38523853
semver "^7.5.4"
38533854
ts-api-utils "^1.0.1"
38543855

3855-
"@typescript-eslint/[email protected]", "@typescript-eslint/utils@^5.10.0":
3856+
"@typescript-eslint/[email protected]", "@typescript-eslint/utils@^5.10.0", "@typescript-eslint/utils@^5.54.0":
38563857
version "5.62.0"
38573858
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86"
38583859
integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==
@@ -14662,7 +14663,7 @@ use-latest-callback@^0.1.5, use-latest-callback@^0.1.7:
1466214663
resolved "https://registry.yarnpkg.com/use-latest-callback/-/use-latest-callback-0.1.9.tgz#10191dc54257e65a8e52322127643a8940271e2a"
1466314664
integrity sha512-CL/29uS74AwreI/f2oz2hLTW7ZqVeV5+gxFeGudzQrgkCytrHw33G4KbnQOrRlAEzzAFXi7dDLMC9zhWcVpzmw==
1466414665

14665-
use-sync-external-store@^1.0.0, use-sync-external-store@^1.2.0:
14666+
use-sync-external-store@^1.0.0:
1466614667
version "1.2.0"
1466714668
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
1466814669
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==

0 commit comments

Comments
 (0)