Skip to content

Commit a2d1f76

Browse files
committed
2 parents 2a97ee5 + 1baa539 commit a2d1f76

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Hooks for fetching, caching and updating asynchronous data in React
1414
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
1515
</a><a href="https://github.com/tannerlinsley/react-query/discussions">
1616
<img alt="Join the discussion on Github" src="https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue" />
17-
</a><a href="https://github.com/tannerlinsley/react-query" target="\_parent">
17+
</a><a href="https://bestofjs.org/projects/react-query"><img alt="Best of JS" src="https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=tannerlinsley%2Freact-query%26since=daily" /></a><a href="https://github.com/tannerlinsley/react-query" target="\_parent">
1818
<img alt="" src="https://img.shields.io/github/stars/tannerlinsley/react-query.svg?style=social&label=Star" />
1919
</a><a href="https://twitter.com/tannerlinsley" target="\_parent">
2020
<img alt="" src="https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow" />

docs/src/components/LayoutDocs.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ export const LayoutDocs = props => {
6060
)}
6161
<div>
6262
{isMobile ? (
63-
<Nav />
63+
<>
64+
<Nav />
65+
<Sticky shadow>
66+
<SidebarMobile>
67+
<SidebarRoutes isMobile={true} routes={routes} />
68+
</SidebarMobile>
69+
</Sticky>
70+
</>
6471
) : (
6572
<Sticky>
6673
<Nav />
@@ -72,17 +79,14 @@ export const LayoutDocs = props => {
7279
/>
7380
<div className="block">
7481
<>
75-
<Sticky shadow>
76-
<SidebarMobile>
77-
<SidebarRoutes isMobile={true} routes={routes} />
78-
</SidebarMobile>
79-
</Sticky>
8082

8183
<div className="container mx-auto pb-12 pt-6 content">
8284
<div className="flex relative">
83-
<Sidebar fixed>
84-
<SidebarRoutes routes={routes} />
85-
</Sidebar>
85+
{!isMobile && (
86+
<Sidebar fixed>
87+
<SidebarRoutes routes={routes} />
88+
</Sidebar>
89+
)}
8690

8791
<div className={s['markdown'] + ' w-full docs'}>
8892
<h1>{props.meta.title}</h1>
@@ -172,7 +176,7 @@ function SidebarRoutes({ isMobile, routes: currentRoutes, level = 1 }) {
172176

173177
const pagePath = removeFromLast(path, '.')
174178
const pathname = addTagToSlug(pagePath, tag)
175-
const selected = slug.startsWith(pagePath)
179+
const selected = slug === pagePath
176180
const route = {
177181
href: pagePath,
178182
path,

docs/src/pages/docs/api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,6 @@ const promise = mutate(variables, {
296296
- The last successfully resolved data for the query.
297297
- `error: null | Error`
298298
- The error object for the query, if an error was encountered.
299-
- `promise: Promise`
300-
- The promise that is returned by the `mutationFn`.
301299
302300
## `queryCache`
303301

docs/src/pages/docs/comparison.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Feature/Capability Key:
99

1010
- ✅ 1st-class, built-in, and ready to use with no added configuration or code
1111
- 🟡 Supported, but as an unoffical 3rd party or community library/contribution
12-
- 🔶 Supported and documented, but requires extra user-code implement
12+
- 🔶 Supported and documented, but requires extra user-code to implement
1313
- 🛑 Not officially supported or documented.
1414

1515
| | React Query | SWR [(Website)](https://github.com/vercel/swr) | Apollo Client [(Website)](https://github.com/apollographql/apollo-client) |

types/index.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export type PaginatedQueryResult<TResult, TError = Error> =
378378

379379
export interface InfiniteQueryResult<TResult, TMoreVariable, TError = Error>
380380
extends QueryResultBase<TResult[], TError> {
381-
data: TResult[]
381+
data: TResult[] | undefined
382382
isFetchingMore: false | 'previous' | 'next'
383383
canFetchMore: boolean | undefined
384384
fetchMore: (
@@ -462,7 +462,6 @@ export interface MutationResultBase<TResult, TError = Error> {
462462
isLoading: boolean
463463
isSuccess: boolean
464464
isError: boolean
465-
promise: Promise<TResult>
466465
reset: () => void
467466
}
468467

@@ -627,7 +626,7 @@ export interface QueryCache {
627626
): void
628627
isFetching: number
629628
subscribe(callback: (queryCache: QueryCache) => void): () => void
630-
clear(): void
629+
clear(options?: { notify?: boolean }): void
631630
resetErrorBoundaries: () => void
632631
}
633632

types/test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function simpleInfiniteQuery(condition: boolean) {
339339
// getFetchMore: (last, all) => 'string',
340340
// });
341341

342-
infiniteQuery.data // $ExpectType number[][]
342+
infiniteQuery.data // $ExpectType number[][] | undefined
343343
infiniteQuery.fetchMore() // $ExpectType Promise<number[][]> | undefined
344344
infiniteQuery.fetchMore('next') // $ExpectType Promise<number[][]> | undefined
345345
infiniteQuery.fetchMore('next', { previous: true }) // $ExpectType Promise<number[][]> | undefined
@@ -352,14 +352,14 @@ function infiniteQueryWithObjectSyntax() {
352352
config: {
353353
getFetchMore: (last: { next: number }) => last.next, // annotation on this type is required to infer the type
354354
},
355-
}).data // $ExpectType { next: number; }[]
355+
}).data // $ExpectType { next: number; }[] | undefined
356356
useInfiniteQuery({
357357
queryKey: ['key', 1],
358358
queryFn: async (key, id, next = 0) => ({ next: next + 1 }),
359359
config: {
360360
getFetchMore: (last: { next: number }) => last.next, // annotation on this type is required to infer the type
361361
},
362-
}).data // $ExpectType { next: number; }[]
362+
}).data // $ExpectType { next: number; }[] | undefined
363363
useInfiniteQuery({
364364
queryKey: 'key',
365365
queryFn: async (
@@ -369,7 +369,7 @@ function infiniteQueryWithObjectSyntax() {
369369
config: {
370370
getFetchMore: (last: { next: number }) => last.next, // annotation on this type is required to infer the type
371371
},
372-
}).data // $ExpectType { next: number; }[]
372+
}).data // $ExpectType { next: number; }[] | undefined
373373
useInfiniteQuery({
374374
queryKey: 'key',
375375
queryFn: async (
@@ -379,15 +379,15 @@ function infiniteQueryWithObjectSyntax() {
379379
config: {
380380
getFetchMore: (last: { next: number }) => last.next, // annotation on this type is required to infer the type
381381
},
382-
}).data // $ExpectType { next: number; }[]
382+
}).data // $ExpectType { next: number; }[] | undefined
383383

384384
useInfiniteQuery<{ next: number }, string, undefined>({
385385
queryKey: 'key',
386-
}).data // $ExpectType { next: number; }[]
386+
}).data // $ExpectType { next: number; }[] | undefined
387387

388388
useInfiniteQuery<{ next: number }, [string], undefined>({
389389
queryKey: ['key'],
390-
}).data // $ExpectType { next: number; }[]
390+
}).data // $ExpectType { next: number; }[] | undefined
391391
}
392392

393393
function log(...args: any[]) {}
@@ -431,6 +431,7 @@ function simpleMutation() {
431431
mutationState.isSuccess // $ExpectType boolean
432432
mutationState.reset // $ExpectType () => void
433433
mutationState.status // $ExpectType "idle" | "loading" | "error" | "success"
434+
mutationState.promise // $ExpectError
434435
}
435436

436437
function mutationWithVariables() {

0 commit comments

Comments
 (0)