statamic-rad-pack / runway

Eloquently manage your database models in Statamic.
https://statamic.com/addons/rad-pack/runway
MIT License
115 stars 49 forks source link

Using JsonResource::withoutWrapping() in Laravel breaks runway listings #303

Closed bastihilger closed 1 year ago

bastihilger commented 1 year ago

Description

It's basically this: https://github.com/statamic/cms/issues/7068 - but with Runway models.

Steps to reproduce

Install fresh Laravel installation. Install Statamic into the Laravel installation. Install Runway addon and link at least one model. Add JsonResource::withoutWrapping() to AppServiceProvider (https://laravel.com/docs/9.x/eloquent-resources#data-wrapping)

In CP go to the model listing - there will be no models listed, and in the console this kind of error is thrown:

TypeError: Cannot read properties of undefined (reading 'length')

Environment

Environment Laravel Version: 10.15.0 PHP Version: 8.2.3 Composer Version: 2.5.5 Environment: local Debug Mode: ENABLED Maintenance Mode: OFF

Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED

Drivers Broadcasting: log Cache: statamic Database: mysql Logs: stack / single Mail: smtp Queue: redis Session: file

Statamic Addons: 2 Antlers: runtime Stache Watcher: Enabled Static Caching: Disabled Version: 4.10.2 PRO

Statamic Addons doublethreedigital/runway: 5.0.10 statamic/eloquent-driver: 2.3.1

bastihilger commented 1 year ago

Just to let you know: this is not a big problem for me personally, I can live without turning off resource wrapping at a global level - but I thought I leave this here to let you know this exists and maybe let others find this if they have the same problem. If you close this as "won't fix" that is totally fine with me, for whatever that is worth  🙂

duncanmcclean commented 1 year ago

Context for when I come back to this: https://github.com/statamic/cms/pull/7072

duncanmcclean commented 1 year ago

This looks to be a little more difficult to fix rather than it was in Core. I'm going to close this issue for now and if it comes back again, I can take another look.