F
Filament13mo ago
harps

Relation manager ignored global scope

I have a model called gaspipesurvey with a large GeoJson object column in the database. (up to 5mb). I have excluded the column using a global scope which now only returns the fields I need and this makes all the tables work fast. But I have added some relationships to the model and added then included them using getRelations() after adding each relationship each tab takes a long time to load when the GeoJson is large. Using debugbar I can see that the following query is called twice. select * from gas_pipe_surveys where gas_pipe_surveys.id = 375 limit 1 1. I wouldn't expect to see select * on this becuae of the global scope. 2. I'm not sure why it's called twice. Backtrace only shows the following
17 vendor/livewire/livewire/src/Features/SupportModels/ModelSynth.php:57
18. /vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php:218
19. /vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php:217
20. /vendor/livewire/livewire/src/Mechanisms/HandleComponents/Synthesizers/ArraySynth.php:30
21. /vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php:218
17 vendor/livewire/livewire/src/Features/SupportModels/ModelSynth.php:57
18. /vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php:218
19. /vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php:217
20. /vendor/livewire/livewire/src/Mechanisms/HandleComponents/Synthesizers/ArraySynth.php:30
21. /vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php:218
If I remove the relationships everything works ok.
1 Reply
harps
harpsOP13mo ago
It looks like it's something to do with the $ownerRecord variable in the RelationManager component, this variables attributes are the full set of columns from the model rather than the scoped one. Can anyone confirm if this is expected behaviour? "The ownerRecord does not respect global scopes"
Want results from more Discord servers?
Add your server