livewire / livewire

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
MIT License
22.45k stars 1.57k forks source link

Handle null in dataGet helper to prevent TypeError #8912

Closed AlexandreBonaventure closed 1 month ago

AlexandreBonaventure commented 1 month ago

Hello, I have found myself using $wire.$get('someObject.nested.property') and when setting someObject to null I had a javascript error because the helper only handle undefined.

image

Also I could have worked around this issue if there was a $set API counterpart for deleting nested properties such as $wire.$delete (will set to undefined) but since it is not available, it would help me here.

I know I am not providing any repro nor tests but hopefully this is a very simple and not controversial change that does not require spending much time on it 🤞

Thanks

calebporzio commented 1 month ago

This makes sense, thanks @AlexandreBonaventure