Skip to content

Commit 4f5e1b1

Browse files
committed
docs: Improve useDebounce endpoint definition
1 parent 13f02d3 commit 4f5e1b1

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

docs/core/api/useDebounce.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export class Issue extends Entity {
5050

5151
export const issueQuery = new RestEndpoint({
5252
urlPrefix: 'https://api.github.com',
53-
path: '/search/issues\\?q=:q?%20repo\\::owner/:repo&page=:page?',
53+
path: '/search/issues',
54+
searchParams: {} as { q: string },
55+
paginationField: 'page',
5456
schema: {
5557
incomplete_results: false,
5658
items: new schema.Collection([Issue]),
@@ -63,8 +65,9 @@ export const issueQuery = new RestEndpoint({
6365
import { useSuspense } from '@data-client/react';
6466
import { issueQuery } from './IssueQuery';
6567

66-
function IssueList({ q, owner, repo }) {
67-
const response = useSuspense(issueQuery, { q, owner, repo });
68+
function IssueList({ query, owner, repo }) {
69+
const q = `${query} repo:${owner}/${repo}`;
70+
const response = useSuspense(issueQuery, { q });
6871
return (
6972
<div>
7073
<small>{response.total_count} results</small>
@@ -98,7 +101,7 @@ export default function SearchIssues() {
98101
{isPending ? '...' : ''}
99102
</label>
100103
<AsyncBoundary fallback={<div>searching...</div>}>
101-
<IssueList q={debouncedQuery} owner="facebook" repo="react" />
104+
<IssueList query={debouncedQuery} owner="facebook" repo="react" />
102105
</AsyncBoundary>
103106
</div>
104107
);
@@ -111,9 +114,5 @@ render(<SearchIssues />);
111114
## Types
112115

113116
```typescript
114-
function useDebounce<T>(
115-
value: T,
116-
delay: number,
117-
updatable?: boolean,
118-
): T;
117+
function useDebounce<T>(value: T, delay: number, updatable?: boolean): T;
119118
```

0 commit comments

Comments
 (0)