morrislaptop / laravel-pulse-4xx

Laravel Pulse Card for 4XX responses like validation, auth and not found
https://packagist.org/packages/morrislaptop/laravel-pulse-4xx
MIT License
22 stars 3 forks source link

[Bug]: Other cards don't load when included #1

Closed johnbacon closed 11 months ago

johnbacon commented 11 months ago

What happened?

When installing and then including in the view file via <livewire:4xx cols='4' rows='2' />, no other cards load.

Console error: Uncaught (in promise) Could not find Livewire component in DOM tree

image

How to reproduce the bug

Package Version

0.0.2

PHP Version

8.1.11

Laravel Version

10.35.0

Which operating systems does with happen with?

Linux

Notes

Using the latest commit in the Pulse beta: https://github.com/laravel/pulse/commit/9c65d50d22529b6034b520257d105ee9b279ca3d

morrislaptop commented 11 months ago

Could you dump the requests that were in the database at the time? In the FourXxCard.php file

On Sat, 9 Dec 2023 at 6:34 am, John Bacon @.***> wrote:

What happened?

When installing and then including in the view file via <livewire:4xx cols='4' rows='2' />, no other cards load.

Console error: Uncaught (in promise) Could not find Livewire component in DOM tree

image.png (view on web) https://github.com/morrislaptop/laravel-pulse-4xx/assets/308588/09ad8e90-72bf-4a3c-a7c4-0d18af8d03ac How to reproduce the bug

  • Install package
  • Attempt to output on page

Package Version

0.0.2 PHP Version

8.1.11 Laravel Version

10.35.0 Which operating systems does with happen with?

Linux Notes

Using the latest commit in the Pulse beta: @.*** https://github.com/laravel/pulse/commit/9c65d50d22529b6034b520257d105ee9b279ca3d

— Reply to this email directly, view it on GitHub https://github.com/morrislaptop/laravel-pulse-4xx/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQRXZRZH253Y4U54LNQMTYINTUXAVCNFSM6AAAAABANDG6Z2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGAZTGMRQG4YDGNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

johnbacon commented 11 months ago

Here is the query:

select (select `key` from `pulse_entries` as `keys` where `keys`.`key_hash` = `aggregated`.`key_hash` limit 1) as `key`, `max`, `count` from (select `key_hash`, max(`max`) as `max`, sum(`count`) as `count` from ((select `key_hash`, max(`value`) as `max`, count(*) as `count` from `pulse_entries` where `type` = '4xx_request' and `timestamp` >= 1702650835 and `timestamp` <= 1702650839 group by `key_hash`) union all (select `key_hash`, max(`value`) as `max`, null as `count` from `pulse_aggregates` where `period` = 60 and `type` = '4xx_request' and `aggregate` = 'max' and `bucket` >= 1702650840 group by `key_hash`) union all (select `key_hash`, null as `max`, sum(`value`) as `count` from `pulse_aggregates` where `period` = 60 and `type` = '4xx_request' and `aggregate` = 'count' and `bucket` >= 1702650840 group by `key_hash`)) as `results` group by `key_hash` order by `count` desc limit 101) as `aggregated`

And the dump() output of $fourXxRequests:

Illuminate\Support\Collection {#953 ▼ // vendor/morrislaptop/laravel-pulse-4xx/src/FourXxCard.php:54
  #items: array:2 [▼
    0 => {#936 ▼
      +"method": "GET"
      +"uri": "test/pulse"
      +"status": 403
      +"latest": Carbon\CarbonImmutable @1702654384 {#947 ▼
        #endOfTime: false
        #startOfTime: false
        #constructedObjectId: "00000000000003b30000000000000000"
        #localMonthsOverflow: null
        #localYearsOverflow: null
        #localStrictModeEnabled: null
        #localHumanDiffOptions: null
        #localToStringFormat: null
        #localSerializer: null
        #localMacros: null
        #localGenericMacros: null
        #localFormatFunction: null
        #localTranslator: null
        #dumpProperties: array:3 [▶]
        #dumpLocale: null
        #dumpDateProperties: null
        date: 2023-12-15 10:33:04.0 America/New_York (-05:00)
      }
      +"count": "9.00"
    }
    1 => {#949 ▼
      +"method": "GET"
      +"uri": "test/asodjfaiodsf"
      +"status": 404
      +"latest": Carbon\CarbonImmutable @1702655662 {#954 ▼
        #endOfTime: false
        #startOfTime: false
        #constructedObjectId: "00000000000003ba0000000000000000"
        #localMonthsOverflow: null
        #localYearsOverflow: null
        #localStrictModeEnabled: null
        #localHumanDiffOptions: null
        #localToStringFormat: null
        #localSerializer: null
        #localMacros: null
        #localGenericMacros: null
        #localFormatFunction: null
        #localTranslator: null
        #dumpProperties: array:3 [▶]
        #dumpLocale: null
        #dumpDateProperties: null
        date: 2023-12-15 10:54:22.0 America/New_York (-05:00)
      }
      +"count": "1.00"
    }
  ]
  #escapeWhenCastingToString: false
}
morrislaptop commented 11 months ago

I couldn't replicate this I'm afraid... could you get a failing test working? FourXXCardTest.php would be a good start.

image