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 various eagerloading bugs #10862

Merged

Commits on Jul 17, 2023

  1. Configuration menu
    Copy the full SHA
    9bed2a3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d0ca9cf View commit details
    Browse the repository at this point in the history
  3. FIX Allow multiple iterations of eager-loaded DataLists

    Includes making sure toArray() uses the correct iteration logic,
    and cloning resets the eagerloaded data for the new clone.
    
    Previously, a second iteration would add every relation item to the
    relation list a second time - so with each iteration your relation list
    count doubled (though it was the same records time and again).
    GuySartorelli committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    95d1c67 View commit details
    Browse the repository at this point in the history
  4. MNT Add missing tests for eagerloaded DataList interactions

    Add tests for:
    - filtered, limited, and sorted DataLists with eagerloaded relations
    - iterating through the list multiple times
    - eagerLoad method can be called anywhere in a query chain
    - eager loaded relation lists can be correctly empty without throwing
      exceptions
    - repeating relations to be eagerloaded in various permutations doesn't
      cause issues
    - eagerloading doesn't negatively impact chunkedFetch functionality
    
    squash
    GuySartorelli committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    acad946 View commit details
    Browse the repository at this point in the history
  5. FIX Protect against loading incorrect eager-loaded relations.

    Don't fetch eager-loaded has_many or many_many unless we've validated
    that the relation IS actually a has_many or many_many relation.
    Also clear eager-loaded relations when flushing the record.
    GuySartorelli committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    3bf845a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ed4c34b View commit details
    Browse the repository at this point in the history