haringsrob / laravel-dev-tools

Developer tools for easier Laravel development (Blade lsp)
Apache License 2.0
84 stars 5 forks source link

Fix for livewire form properties not being found. #16

Open Fsmash opened 3 months ago

Fsmash commented 3 months ago

Fix for nested livewire form properties not being found as discussed in issue https://github.com/haringsrob/laravel-dev-tools/issues/15. Tried to be as unobtrusive as possible. Additional reflection was not necessary since "DataStore" already holds the "BladeComponentData" for Livewire forms.

Only issue is that this fix only supports one level of nesting and the class with the nested properties must also be a Livewire component. I could have made a recursive function and implemented actual reflection for classes not found in the "availableComponents" array, but I don't think that is a good idea. This should be fine since it doesn't support bad programming practices with Livewire. Livewire properties really shouldn't be nested more than one level deep, and they really should be in a Livewire form if they are nested.

Lastly, I wanted to write a test but ran into this issue. Didn't look that deep into it but if it is a simple fix let me know.

image

haringsrob commented 1 week ago

If anyone can confirm this works I can merge it :)