-
-
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
[RFR] Use reference input #3313
Conversation
822e9a9
to
b7c8498
Compare
e650393
to
2d63f10
Compare
25489e9
to
87c0d65
Compare
3548e8d
to
d11e9ed
Compare
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.
Awesome, almost there! Love the unit test coverage, great job on that.
@@ -922,7 +922,7 @@ The child component may further filter results (that's the case, for instance, f | |||
|
|||
The child component receives the following props from `<ReferenceInput>`: | |||
|
|||
- `isLoading`: whether the request for possible values is loading or not | |||
- `loading`: whether the request for possible values is loading or not |
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.
this is a BC break ; please add a migration guide in the UPDATE.md file
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.
And btw, why renaming it ?
@@ -64,26 +55,16 @@ export interface UseReferenceProps { | |||
* | |||
* @returns {ReferenceProps} The reference props | |||
*/ | |||
export const useReference = ({ | |||
allowEmpty = false, | |||
export const getResourceLinkPath = ({ |
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.
no need to export it, it's the default export
* @property {Object} referenceRecord: the referenced record. | ||
* @property {string | false} resourceLinkPath link to the page of the related record (depends on link) (false is no link) | ||
*/ | ||
|
||
/** | ||
* Fetch reference record, and return it when avaliable | ||
* Fetch reference record, and return it when available also provide link toward the referenced resource |
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.
bad jsDoc, it is now getResourceLinkPath
...props | ||
}) => { | ||
return children({ | ||
...props, |
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.
it's weird to pass the props there, in other controllers (e.g. useEditController), it's the caller's job to pass the initial props
}, | ||
}); | ||
|
||
rerender(() => { |
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.
this should not be in this test, which says 'on mount'
* source: 'post_id', | ||
* }); | ||
* | ||
* The hook alos allow to filter results. it returns a `setFilter` |
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.
* The hook alos allow to filter results. it returns a `setFilter` | |
* The hook also allow to filter results. It returns a `setFilter` |
Also, needs rebase |
…ec.tsx Co-Authored-By: Francois Zaninotto <francois@marmelab.com>
…ec.tsx Co-Authored-By: Francois Zaninotto <francois@marmelab.com>
…ec.tsx Co-Authored-By: Francois Zaninotto <francois@marmelab.com>
…ec.tsx Co-Authored-By: Francois Zaninotto <francois@marmelab.com>
…ec.tsx Co-Authored-By: Francois Zaninotto <francois@marmelab.com>
…ec.tsx Co-Authored-By: Francois Zaninotto <francois@marmelab.com>
….spec.tsx Co-Authored-By: Francois Zaninotto <francois@marmelab.com>
Co-Authored-By: Francois Zaninotto <francois@marmelab.com>
347ef96
to
173cb12
Compare
UPGRADE.md
Outdated
|
||
## ReferenceInputController isLoading injected props renamed to loading | ||
|
||
When using custom component with ReferenceInputController, you should rename the component `isLoading` props to `loading`. |
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.
s/props/prop/
@@ -922,7 +922,7 @@ The child component may further filter results (that's the case, for instance, f | |||
|
|||
The child component receives the following props from `<ReferenceInput>`: | |||
|
|||
- `isLoading`: whether the request for possible values is loading or not | |||
- `loading`: whether the request for possible values is loading or not |
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.
And btw, why renaming it ?
As requested by djhi at #3313 (comment)
Because I asked for it, for consistency with the |
No description provided.