Skip to content
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

Merged
merged 3 commits into from Feb 18, 2021

Conversation

djhi
Copy link
Contributor

@djhi djhi commented Feb 17, 2021

No description provided.

@djhi djhi added the RFR Ready For Review label Feb 17, 2021
@djhi djhi added this to the 3.12.5 milestone Feb 17, 2021
state.admin.references.oneToMany[relatedTo].ids;
(state.admin.references.oneToMany[relatedTo] &&
state.admin.references.oneToMany[relatedTo].ids) ||
null;
Copy link
Member

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: [] },
Copy link
Member

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: {},
Copy link
Member

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

@fzaninotto fzaninotto merged commit ae4e860 into master Feb 18, 2021
@fzaninotto fzaninotto deleted the fix-use-get-many-references-loaded-state branch February 18, 2021 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants