jonassiewertsen / statamic-livewire

A Laravel Livewire integration for Statamics antlers engine
91 stars 16 forks source link

Livewire 3 / statamic-livewire 3 Error #47

Closed bretvanhorn closed 1 year ago

bretvanhorn commented 1 year ago

Hi-

I am getting an error I am having trouble resolving when I have Statamic Livewire installed. It has worked well until we upgraded Statamic to 4 and Livewire to 3, now the entire front end of the site will not load and displays the attached error.

If I uninstall Statamic Livewire, the error goes away. Strangely, I think I have commented out all the Antlers Livewire calls and it is still throwing this error. Any guidance will be welcome and please let me know if you need more informaiton. See screenshots for error and versions of everything.

Thanks!

Screenshot 2023-10-17 at 1 51 19 PM Screenshot 2023-10-17 at 1 51 41 PM
jonassiewertsen commented 1 year ago

Can you show the complete trace?

Is any class of the addon included?

Did you use the experimental feature? https://github.com/jonassiewertsen/statamic-livewire/#experimental-statamic-support

It seems that Livewire tries to synthesize a null value, which does not work. Maybe a problem with your properties?

https://livewire.laravel.com/docs/properties

marcorieser commented 1 year ago

Not sure if this helps but in v2 I created dynamic properties on the fly in the mount() method and was binding them in the template. In v3 this threw some errors (not sure if the same as here) but I had to switch from:

class MyComponent extends ... {
public function mount() {
  foreach(PropertyProvider::all() as $property {
    $this->$property = '';
  }
}

to:

class MyComponent extends ... {
public $form;
public function mount() {
  foreach(PropertyProvider::all() as $property {
    $this->form[$property] = '';
  }
}
bretvanhorn commented 1 year ago

@jonassiewertsen and @marcorieser Thank you for your responses and suggestions. At this time, I am pretty sure this is on my end and has more to do with property types, etc. You can close this ticket for now and if for some reason I find it's not on my end, I'll let you know. But I am pretty sure it's all me. :-)