wire-elements / wire-extender

Wire Extender allows you to embed any Livewire component on any website or even within a static HTML file.
https://wire-elements.dev/blog/embed-livewire-components-using-wire-extender
MIT License
245 stars 9 forks source link

Undefined array key "key" in Release 0.0.7 #25

Closed dircm closed 3 months ago

dircm commented 3 months ago

Hi @PhiloNL I had to rollback my production release to 0.0.6 due to an error :

Undefined array key "key" thrown in EmbedController on line 15:

$componentKey = $component['key'];

For reference, here is my embed code: (this is a working version using 0.0.6 on my beta server)

<div style="background-color:white; border-radius: 25px; box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;">
    <script src="https://beta.aeroquote.com/vendor/wire-elements/wire-extender.js"></script>
    <livewire data-component="widget.enquiry-widget" data-params='{"id":"9aa07c64-625a-46e1-b2ae-50a7aad79372"}'></livewire>
</div>

I'll have a look through my forked repo and PR any fixes I come up with.

Thanks, Tom.

JGlueck-WIKA commented 3 months ago

Might be a silly question, but have you re-published the assets after updating the package so that it pulls the updated JS?

php artisan vendor:publish --tag=wire-extender

dircm commented 3 months ago

Thanks @JGlueck-WIKA ! You have helped me solve it. That command is in my post update BUT....

By default vendor:publish dosen't overwrite existing files. So the --force flage is needed to update the js file.

php artisan vendor:publish --force --tag=wire-extender

PhiloNL commented 3 months ago

I'm glad that the issue is solved. I'll add the command to the release notes for future reference :) Sorry for the inconvenience.