Skip to content

N+1 Query tab from beyondcode/laravel-query-detector tab is always empty since v3.15.0 #1812

@valentin-duveau

Description

@valentin-duveau

Hi!

I'm using the N+1 Query Detector package with the Debugbar output provider, and I've noticed that since laravel-debugbar v3.15.0 the "N+1 Query" tab is always empty, despite the fact lazy-loading queries are clearly visible in the Queries tab (and using another output provider also works).

To reproduce:

  1. Run:
composer create-project laravel/laravel:^12 test-debugbar && cd test-debugbar
composer require --dev barryvdh/laravel-debugbar
composer require --dev beyondcode/laravel-query-detector
php artisan vendor:publish --provider="BeyondCode\QueryDetector\QueryDetectorServiceProvider"
  1. Add \BeyondCode\QueryDetector\Outputs\Debugbar::class to output in config/querydetector.php
  2. Add something in any controller that would trigger lazy-loading in a loop and visit the page
  3. See that the N+1 alert shows up, but the N+1 Queries tab remains empty

I've narrowed down the problem to this commit. It seems like this makes debugbar render before the laravel-query-detector middleware which is supposed to add messages to its collector.

I'm not entirely sure if this is something that should be fixed in debugbar or laravel-query-detector. Maybe query-detector could also add itself to the web middleware group so it runs before debugbar renders.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions