Skip to content

Fix lazy loaded nested associations #154

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tlconnor
Copy link

@tlconnor tlconnor commented Dec 8, 2020

Closes #129

What is the current behavior?

Relationships blocks are empty when including nested lazy loaded relationships.

What is the new behavior?

Relationship blocks are properly populated when including nested lazy loaded relationships. The behavior is now consistent with the non-lazy behavior.

The root cause of the problem was that the includes_list passed to #record_hash was not correctly formatted, resulting in included always being false. The behavior of #record_hash is now consistent with #get_included_records.

Checklist

Please make sure the following requirements are complete:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes /
    features)
  • All automated checks pass (CI/CD)

@tlconnor
Copy link
Author

tlconnor commented Dec 8, 2020

CI is failing on rubocop violations, however they all have nothing to do with my changes.

@stas
Copy link
Collaborator

stas commented Dec 8, 2020

Thanks @tlconnor, I'll take a look.

@btagliani
Copy link

Hi @stas! Will this be included/fixed in v3?

@stas
Copy link
Collaborator

stas commented May 13, 2021

@btagliani yup, we'll be deprecating the API for lazy relationship. Please take a look at the #141 for more details.

@williantenfen
Copy link

👍

@a3626a
Copy link

a3626a commented Mar 19, 2024

Recently we are facing this issue : #246

Even though lazy loading api will be deprecated, this fix is relevant for v2 users.

I hope this to be merged, and 2.2.1 version to be released.

Thanks for your work.


For someone who are finding answers:

Use this https://github.com/veeqo/jsonapi-serializer fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lazy Load Data does not respect inclusion of nested associations
5 participants