Skip to content

Commit 722fd92

Browse files
committed
chore: add unique key in react-query playground
1 parent 5c48631 commit 722fd92

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

playground/modules/wizard/reactQuery/lazyQuery.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ type Props = {
2626

2727
const LazyQueryStep: React.FC<Props> = ({ number }) => {
2828
const { handleStep, isLoading } = useWizard();
29-
const { error, data, mutateAsync } = useMutation('repDataMutation', () =>
30-
fetch('https://jsonplaceholder.typicode.com/todos').then((res) =>
31-
res.json(),
32-
),
29+
const { error, data, mutateAsync } = useMutation(
30+
`getTodosLazy${number}`,
31+
() =>
32+
fetch('https://jsonplaceholder.typicode.com/todos').then((res) =>
33+
res.json(),
34+
),
3335
);
3436

3537
handleStep(() => {

playground/modules/wizard/reactQuery/queryStep.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Props = {
2323
};
2424

2525
const QueryStep: React.FC<Props> = ({ number }) => {
26-
const { isLoading, error, data } = useQuery('repoData', () =>
26+
const { isLoading, error, data } = useQuery(`getTodoById${number}`, () =>
2727
fetch(`https://jsonplaceholder.typicode.com/todos/${number}`).then((res) =>
2828
res.json(),
2929
),

0 commit comments

Comments
 (0)