-
-
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
Fix useGetManyReference loading state detection #5931
Conversation
state.admin.references.oneToMany[relatedTo].ids; | ||
(state.admin.references.oneToMany[relatedTo] && | ||
state.admin.references.oneToMany[relatedTo].ids) || | ||
null; |
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.
if the problem is undefined
vs null
, I'd rather you change the isDataLoaded
to use != null
instead of !== null
- less risk of breaking things.
{ | ||
admin: { | ||
references: { | ||
oneToMany: { ids: [] }, |
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.
same. Also, you test with a list of empty ids, you miss a test wit ha list of non-empty ids
{ | ||
admin: { | ||
references: { | ||
oneToMany: {}, |
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 not the normal shape of the state. there is a key representing the reference between reference
and oneToMany
No description provided.