CodeWithDennis / filament-select-tree

The multi-level select field lets you pick one or multiple options from a list that is neatly organized into different levels.
MIT License
225 stars 32 forks source link

fix: component dehydration #83

Closed saade closed 8 months ago

saade commented 8 months ago

When using relationships, fields must not be dehydrated, otherwise, (when strict) a MassAssignmentException is thrown.

As far i can see, this plugin only supports relationships, right? If yes, its fine as is. If not (supports arrays too) we need to add this fix only inside relationship() method.

Thanks!

CodeWithDennis commented 8 months ago

The plugin only supports BelongsTo and HasMany at the moment.

CodeWithDennis commented 8 months ago

Thanks @saade !

ariaieboy commented 8 months ago

@CodeWithDennis this PR is broking my applications. It sets the relation to null when I set ->dehydrated(true) on the field it works just fine

saade commented 8 months ago

I see why, the component is not handling the BelongsTo relationship inside saveRelationshipsUsing i thought it was. Gonna submit a fix asap.