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

BelongsToMany has many duplicate queries on detail page #6479

Closed
niekdemelker opened this issue Jul 30, 2024 · 4 comments
Closed

BelongsToMany has many duplicate queries on detail page #6479

niekdemelker opened this issue Jul 30, 2024 · 4 comments
Labels
bug Verified bug by the Nova team fix incoming A fix is in review

Comments

@niekdemelker
Copy link

niekdemelker commented Jul 30, 2024

Description:

When using an BelongsToMany field, this will show all related models on the Details page. This request to fetch all relation records however calls the DB many times to fetch the ViaResource model. Sometimes over 20 times in one request (Strange enough Model::preventLazyLoading(! app()->isProduction()) doesn't block this behaviour.).

The logging states this call is done repeatedly from 'Http/Requests/InteractsWithRelatedResources.php:72' and one time from 'Http/Requests/QueriesResources.php:38'.

Detailed steps to reproduce the issue on a fresh Nova installation:

  • run migrations & seeder
  • create nova user
  • Open Nova and navigate to 'service levels' and open the details page of the generated record
  • Open Telescope and search on the tag 'bug' to see the recorded queries of this request
@crynobone
Copy link
Member

Please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)

@crynobone crynobone added the needs more info More information is required label Jul 30, 2024
@niekdemelker
Copy link
Author

niekdemelker commented Jul 30, 2024

Please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)

@crynobone I already did that. the steps to reproduce take into account you use the provided repo. Se https://github.com/niekdemelker/issue-6479

@niekdemelker
Copy link
Author

Do you still require more info? If you need more information on some parts please tell so I can Elaborate

@crynobone crynobone added the pending Issues that are pending triage label Aug 8, 2024
@crynobone crynobone added bug Verified bug by the Nova team fix incoming A fix is in review and removed needs more info More information is required pending Issues that are pending triage labels Oct 15, 2024
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Verified bug by the Nova team fix incoming A fix is in review
Projects
None yet
Development

No branches or pull requests

2 participants