EDIT: Figured it out, will leave here for anybody else who made the same mistake as me. I had a model referenced as a public variable in the Livewire component. Making it private fixed the issue (and is also just correct practice, my bad).
I’m having a weird problem where a seemingly innocuous “wire:click” keeps trying to fire off a random, arbitrary database query (therefore causing an error).
This is the HTML element, simplified:
<li wire:click="$set('selected', 'Text')">Dummy</li>
And this is the error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘project-name.templates’ doesn’t exist (SQL: select * from
templates
wheretemplates
.id
is null limit 1)
I’ve tried calling a function for the wire:click and get the same error. I have no function that calls the database in the controller. The li tag isn’t in a form, it’s just in a unordered list.
I’ve tried appending .prevent to the wire:click in case for some reason there was some default behaviour at play.
Any ideas?