inertia
inertia copied to clipboard
Q: Callbacks - DOMException: Failed to execute 'replaceState' on 'History': cell => cell could not be cloned.
Versions:
@inertiajs/inertiaversion: 0.11.0@inertiajs/inertia-svelteversion: 0.8.0
Describe the problem:
Ahoy
I have an array of column definitions, also inline callbacks, i.e.
columns['tax_rate'] = {
formatter: (cell) => cell //formatToPercentage(cell)
};
As soon as this is added, the error occurs:
Uncaught (in promise) DOMException: Failed to execute 'replaceState' on 'History': cell => cell could not be cloned.
at n2.replaceState (http://localhost:3000/node_modules/.vite/deps/chunk-WUFD4MQ7.js?v=bbd85e7b:3374:40)
at n2.saveScrollPositions (http://localhost:3000/node_modules/.vite/deps/chunk-WUFD4MQ7.js?v=bbd85e7b:3241:14)
at n2.resetScrollPositions (http://localhost:3000/node_modules/.vite/deps/chunk-WUFD4MQ7.js?v=bbd85e7b:3248:18)
at http://localhost:3000/node_modules/.vite/deps/chunk-WUFD4MQ7.js?v=bbd85e7b:3368:22
As soon as I comment it out, everything works.
I looked at the other reports in that area, but those were all data related and some JSON back and forth parsing helped. I do not know how this could be leveraged here, when I just want to configure some callbacks to pass to a component as definition.
Maybe you got an idea.
Thanks a lot in advance
Ahoy
Just FYI, I created a patch-package based on https://github.com/inertiajs/inertia/issues/854 for now to resolve this locally. Maybe this is a general solution. @inertiajs+inertia+0.11.0.patch.zip
Maybe this helps others for now, too.
Thanks
@reinink do you plan to fix this in the last version?
@nea it works for me too! Did you make a pull request?
Ahoy @lucabecchetti
Happy this works for you, too. I created a PR now https://github.com/inertiajs/inertia/pull/1250 but I am not sure if this is the best solution, just one solution ^^'
Cheers
Having same issue! I fixed it using the "JSON parse JSON stringify" way:
const item = ref(props.item)
to
const item = ref(JSON.parse(JSON.stringify(props.item)))
Hey! Thanks so much for your interest in Inertia.js and for sharing this issue/suggestion.
In an attempt to get on top of the issues and pull requests on this project I am going through all the older issues and PRs and closing them, as there's a decent chance that they have since been resolved or are simply not relevant any longer. My hope is that with a "clean slate" me and the other project maintainers will be able to better keep on top of issues and PRs moving forward.
Of course there's a chance that this issue is still relevant, and if that's the case feel free to simply submit a new issue. The only thing I ask is that you please include a super minimal reproduction of the issue as a Git repo. This makes it much easier for us to reproduce things on our end and ultimately fix it.
Really not trying to be dismissive here, I just need to find a way to get this project back into a state that I am able to maintain it. Hope that makes sense! ❤️