F
Filament13mo ago
John

Alpine wire entangle causes "Uncaught (in promise) TypeError: Cannot read properties of null"

I'm using a custom form component, based on Textarea. As soon as I put this in:
x-data="{ state: $wire.entangle('{{ $getStatePath() }}').defer }"
x-data="{ state: $wire.entangle('{{ $getStatePath() }}').defer }"
and I click a button on the page, I get:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'child_description')
at livewire.js?id=90730a3b0e7144480175:14:130978
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'child_description')
at livewire.js?id=90730a3b0e7144480175:14:130978
That "child_description" is inside a JSON field:
Textarea::make('viewpoint.child_description')
Textarea::make('viewpoint.child_description')
When the field has a value, the error is gone. But initially, the JSON is null. (empty string doesn't solve the problem) Any idea how to solve this?
3 Replies
ChesterS
ChesterS13mo ago
can you try this x-data="{ state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }} }"
John
JohnOP13mo ago
That gives Public method [$entangle] not found on component. Maybe because I'm on v2? I tried this: state: $wire.{{ $applyStateBindingModifiers('entangle(\'' . $getStatePath() . '\')') }} , which gave the same error.
ChesterS
ChesterS13mo ago
Oh shit sorry didn't notice this is V2, my bad
Want results from more Discord servers?
Add your server