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

Let us specify which relations to load when using withAllRecursive ? #1726

Open
2 tasks done
vesper8 opened this issue Nov 6, 2023 · 2 comments
Open
2 tasks done
Labels
enhancement New feature or request

Comments

@vesper8
Copy link

vesper8 commented Nov 6, 2023

Describe the feature

Right now I want to use withAllRecursive but it's incredibly slow and I believe that's because it loads relationships recursively both up and down.. meaning that it loads all relations including belongsTo and hasMany recursively which creates a recursive loop and crashes my app.

I would like to specify which relations to load recursively so that I only load child relations and ignore parent relations.

Is there any chance you could add this functionality? Or can I already do this by passing a callback to withAll ?

Additional information

  • Would you be willing to help implement this feature?

Final checks

@CodeDredd
Copy link
Owner

You are absolutly right. You can end in relation "loop" if the child has again a relation to the parent.
I have to think about it first what the smart solution for this is. Surly it would be already good if the relations could be defined. Trying to add this first and then maybe working on a better withAllRecursive solution

@CodeDredd CodeDredd added enhancement New feature or request and removed pending triage labels Jan 16, 2024
@vesper8
Copy link
Author

vesper8 commented Jan 17, 2024

Thanks.. yes I do think this is a problem area right now. both withAll and withAll recursive are very bad for performance. This wasn't the case with vuex-orm, not sure why. This has led me to be more strict when defining which relations I want loaded.. which is fine and is probably better anyway as withAll and withAllRecursive are kind of "lazy" methods anyway. Still I think it would be good to look into it, or maybe add a warning of the potential performance pitfalls of these helpers.

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

No branches or pull requests

2 participants