-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TypeScript] Make types more strict in ra-ui-materialui, part III #9795
Changes from all commits
f6afcb1
2a48608
2c96057
dce5986
984a9c0
3f801e3
7ac9864
b50e679
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ describe('<useList />', () => { | |
{ id: 2, title: 'world' }, | ||
{ id: 1, title: 'hello' }, | ||
], | ||
error: undefined, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is to make the output compatible with the ListControllerResult, which is using useQueryResult signature. In it, the empty error is |
||
error: null, | ||
total: 2, | ||
}) | ||
); | ||
|
@@ -79,7 +79,7 @@ describe('<useList />', () => { | |
{ id: 1, title: 'hello' }, | ||
{ id: 2, title: 'world' }, | ||
], | ||
error: undefined, | ||
error: null, | ||
total: 2, | ||
}) | ||
); | ||
|
@@ -120,7 +120,7 @@ describe('<useList />', () => { | |
], | ||
page: 2, | ||
perPage: 5, | ||
error: undefined, | ||
error: null, | ||
total: 7, | ||
}) | ||
); | ||
|
@@ -159,7 +159,7 @@ describe('<useList />', () => { | |
isFetching: true, | ||
isLoading: false, | ||
data: [{ id: 2, title: 'world' }], | ||
error: undefined, | ||
error: null, | ||
total: 1, | ||
}) | ||
); | ||
|
@@ -188,7 +188,7 @@ describe('<useList />', () => { | |
isFetching: false, | ||
isLoading: false, | ||
data: [{ id: 2, title: 'world' }], | ||
error: undefined, | ||
error: null, | ||
total: 1, | ||
}) | ||
); | ||
|
@@ -223,7 +223,7 @@ describe('<useList />', () => { | |
{ id: 3, items: 'four' }, | ||
{ id: 4, items: ['five'] }, | ||
], | ||
error: undefined, | ||
error: null, | ||
total: 3, | ||
}) | ||
); | ||
|
@@ -258,7 +258,7 @@ describe('<useList />', () => { | |
{ id: 3, items: 'four' }, | ||
{ id: 4, items: ['five'] }, | ||
], | ||
error: undefined, | ||
error: null, | ||
total: 2, | ||
}) | ||
); | ||
|
@@ -287,7 +287,7 @@ describe('<useList />', () => { | |
isFetching: false, | ||
isLoading: false, | ||
data: [{ id: 2, title: { name: 'world' } }], | ||
error: undefined, | ||
error: null, | ||
total: 1, | ||
}) | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -485,7 +485,7 @@ export interface ListControllerLoadingResult<RecordType extends RaRecord = any> | |
error: null; | ||
isPending: true; | ||
} | ||
export interface ListControllerLoadingErrorResult< | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this name didn't make sense |
||
export interface ListControllerErrorResult< | ||
RecordType extends RaRecord = any, | ||
TError = Error | ||
> extends ListControllerBaseResult<RecordType> { | ||
|
@@ -513,6 +513,6 @@ export interface ListControllerSuccessResult<RecordType extends RaRecord = any> | |
|
||
export type ListControllerResult<RecordType extends RaRecord = any> = | ||
| ListControllerLoadingResult<RecordType> | ||
| ListControllerLoadingErrorResult<RecordType> | ||
| ListControllerErrorResult<RecordType> | ||
| ListControllerRefetchErrorResult<RecordType> | ||
| ListControllerSuccessResult<RecordType>; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { useEffect } from 'react'; | ||
import { useStore } from '../store'; | ||
import { debounce } from 'lodash'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is unrelated to the PR, but I noticed that the bundles for the demos were embarking the entire lodash, so I figured I'd fix this regression. |
||
import { useLocation } from 'react-router'; | ||
import debounce from 'lodash/debounce'; | ||
|
||
import { useStore } from '../store'; | ||
|
||
/** | ||
* A hook that tracks the scroll position and restores it when the component mounts. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore: 'useMemo' is imported line 2 but no more used, we may could remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed