livewire / livewire

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

Cannot read property 'receiveMessage' of undefined #376

Closed faustbrian closed 4 years ago

faustbrian commented 4 years ago

Hey, finally had some time again to jump back into Livewire but ran into an odd issue with forms. Seems to happen in old applications and also a completely fresh Laravel installation.

VM79 livewire.js:3287 Uncaught (in promise) TypeError: Cannot read property 'receiveMessage' of undefined
    at Connection.onMessage (VM79 livewire.js:3287)
    at Object.Connection.driver.onMessage (VM79 livewire.js:3271)
    at VM79 livewire.js:3142
_Store__WEBPACK_IMPORTED_MODULE_1__["default"].findComponent(payload.id).receiveMessage(payload);

When placing some console logs the issue becomes more clear.

{"componentsById":{},"listeners":{"listeners":[]},"livewireIsInBackground":false,"livewireIsOffline":false,"hooks":{"availableHooks":["componentInitialized","elementInitialized","elementRemoved","messageSent","messageFailed","responseReceived"],"bus":{"listeners":[]}}}

The componentsById property is empty so findComponent returns undefined. The questions is why it is undefined.

To rule out any issues with packages or middlewares I made sure to use a fresh Laravel installation just with Livewire but the same issue persists. I even tried to use the copy & paste contact form component from https://laravel-livewire.com/docs/input-validation/ but again the same issue.

P. S.: @calebporzio did you manage to setup GitHub Sponsors or alike.

calebporzio commented 4 years ago

@faustbrian - is this resolved? Why did you close it?

Also, no... not yet. Thanks for checking in though!