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

[Bug]: Data not passing #87

Closed iRaziul closed 8 months ago

iRaziul commented 8 months ago

What happened?

I found a serious but weird issue. 🫨

My models are Category and Product where the category has child categories.

I used this code to select a category for the product and this was working fine but for the last couple of days it is not working as expected.

SelectTree::make('category_id')
    ->label('Category')
    ->required()
    ->relationship('category', 'name', 'parent_id')
    ->defaultOpenLevel(5)
    ->placeholder('Select category'),

This renders the field as I wanted: image

I've selected the category and submitted the form but got this response: image

How to reproduce the bug

SelectTree::make('category_id')
    ->label('Category')
    ->required()
    ->relationship('category', 'name', 'parent_id')
    ->defaultOpenLevel(5)
    ->placeholder('Select category'),

Package Version

3.1.32

PHP Version

8.2

Laravel Version

10.4

Which operating systems does with happen with?

Windows, Linux

Notes

I can provide you the website link privately so that you can have a look.

CodeWithDennis commented 8 months ago

This might have to do with the same issue (https://github.com/CodeWithDennis/filament-select-tree/pull/85) @saade

@iRaziul Could you check if dehydrated(true) fixes it?

iRaziul commented 8 months ago

This might have to do with the same issue (#85) @saade

@iRaziul Could you check if dehydrated(true) fixes it?

Yeah it seems like working after using dehydrated()

Sjoerd24 commented 8 months ago

I have the same problem, data is not on any field passing through. Is the mentioned fixed above a def fix or is a better solution coming along? Bit weird that all selecttree fields aren't working anymore in my site, luckly still in testing fase. :)

edit: ->dehydrated(true) fixes also my problem. But this shouldn't be standard behaviour right?

saade commented 8 months ago

89

CodeWithDennis commented 8 months ago

89

Merged, please check your application with the latest version. @Sjoerd24

Sjoerd24 commented 8 months ago

@CodeWithDennis Thanks, it all works now again!