[Bug]: "Uncaught Snapshot missing on Livewire component with id" on Mutate #1345
Replies: 14 comments
-
How are you including the Livewire scripts please? Did you previously publish the views for this package? Looking at the "before" code, some elements appear to be missing. |
Beta Was this translation helpful? Give feedback.
-
I am using the manual bundling mode with Vite. I am following the recommended setup in the second part of the paragraph, my code is exactly the same
I don't remember, but as of now they're not published.
This is the full code of the table. Also note there are some empty blocks being put by Livewire |
Beta Was this translation helpful? Give feedback.
-
In your view/blade, can you try wrapping the table component with a div with a wire:key Is it after any lifecycle event (e.g. reorder the table)? Does it happen if you aren't using the Vite dev server? Just trying to narrow down my debugging etc! |
Beta Was this translation helpful? Give feedback.
-
This is the setup. The father component renders many child component, and some of them are the Datatables.
After any Livewire event that triggers a Livewire refresh/render, even from a father component.
Just tested, yes. Also keep in mind that the setup with Livewire 2 and the latest release of the Datatables v2 was perfectly working. But to me it seems something that has to do with DOM-diffing or how re-renders are managed, Livewire is working perfectly in all the other views. Also I'll be joining the Discord, so if you prefer I can jump in when I see you online :) |
Beta Was this translation helpful? Give feedback.
-
One key element that differs to v2 is that v3 injects some JS and CSS for the Alpine functions in use. It doesn't seem that this is the issue however! However! I did notice that your table is called table. Are all of them called table? I can see a wire:key='table-table' in your code dump, if they're all the same then Livewire will get grumpy! If you add
Or pass a unique tableName in as a parameter, does that sort it? Otherwise I'll be on discord probably later today. |
Beta Was this translation helpful? Give feedback.
-
I don't know if it can help but the error I'm getting is in Javascript console, I'm not getting an Ignition page, so the error is in the frontend.
It is the only table being shown in the project atm, despite that I changed the property you told me about but nothing changed. As of now, the wire:snapshot is showing |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Yes, it has. wire:id keeps being a random string every time, but I'm guessing it's normal.
Done, still nothing.
Yes, styles and JS files are being included.
My app is just in http://localhost:80. Vite dev server in http://localhost:5173/
Sure. it's mostly importing plugins and assigning them.
I joined, I can't find any voice channel tho, am I missing something? |
Beta Was this translation helpful? Give feedback.
-
Can you share:
Definitely seems that there's some wire:key clash or similar going on here, as Livewire is losing track of the component. If you can share the resultant HTML of the first load (attach the page source as a file please), then I will be able to tell better! |
Beta Was this translation helpful? Give feedback.
-
I'm attaching the full page both before and after the mutation and the Datatable code plus the tab-swapper blade file. The parent component is called "tab-swapper". I am gonna refer to some lines of the "before" file so you can understand better. Tab-swapper starts at line 1033. |
Beta Was this translation helpful? Give feedback.
-
Is that the actual code for tab-swapper.blade.php? If so, you'll have a variety of issues with how Livewire v3 behaves and your JS code, and that does explain the issue(s) you're having. Plus having a 15,000 line generated HTML is going to cause Livewire some pain in tracking anything! The following will solve the immediate problem
Effectively, your JS code to set the Active Tab won't be running properly, therefore won't entangle correctly, and you'll end up with it not being able to find the component(s). The rest is definitely beyond the scale of an issue here to be honest. If you jump on Discord then I'll give you a few pointers where I reasonably can, but also
|
Beta Was this translation helpful? Give feedback.
-
To be honest, I'd probably remove your current tabs implementation, and use one of the existing components. It's definitely related to how your Tabs are working. I'm happy to recommend on Discord, but I'm not going to start cross-linking repos here. |
Beta Was this translation helpful? Give feedback.
-
I'm adding a fix for lazy loading that will likely fix this, expect on Monday. Is present in v3-develop at the mo |
Beta Was this translation helpful? Give feedback.
-
@AleAtSoftplace - This should be fixed in v3-develop, if issue persists, please reply on this thread. Anyone experiencing this issue at a later date, please open a new discussion rather than replying to this one. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
Hello everyone,
I'm testing the dev-v3-master branch with Livewire 3, and I'm getting " Uncaught Snapshot missing on Livewire component with id" when Livewire mutates the page, crashing Livewire and forcing me to refresh the application page to make it work.
The full stack trace is the following:
Uncaught Snapshot missing on Livewire component with id: hcMFVHZKwhk7elwW8KtM [livewire.esm.js:1634:9](http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js) onMutate http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js:1634 (Async: MutationCallback) js http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js:1524 __require http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js:8 <anonymous> http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js:6075
From what I observed, the Div with the wire:id loses all the attributes expect for the wire:id of the component.

BEFORE onMutate CALL
AFTER onMutate CALL (exception gets thrown)
How to reproduce the bug
Render a datatable and trigger a Livewire mutation, even from other components
Package Version
dev-v3-master 4250511
PHP Version
8.1.x
Laravel Version
10.21
Alpine Version
3.1.12, bundled with Livewire 3
Theme
Tailwind 3.x
Notes
Full code of the Component:
Error Message
Uncaught Snapshot missing on Livewire component with id: 6dFukQtQSEvItPQ0z9mQ livewire.esm.js:1634:9
onMutate http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js:1634
(Async: MutationCallback)
js http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js:1524
__require http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js:8
http://localhost:5173/vendor/livewire/livewire/dist/livewire.esm.js:6075
Beta Was this translation helpful? Give feedback.
All reactions