inertia icon indicating copy to clipboard operation
inertia copied to clipboard

Q: Callbacks - DOMException: Failed to execute 'replaceState' on 'History': cell => cell could not be cloned.

Open nea opened this issue 3 years ago • 5 comments

Versions:

  • @inertiajs/inertia version: 0.11.0
  • @inertiajs/inertia-svelte version: 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

nea avatar Aug 04 '22 08:08 nea

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

nea avatar Aug 05 '22 08:08 nea

@reinink do you plan to fix this in the last version?

lucabecchetti avatar Aug 10 '22 09:08 lucabecchetti

@nea it works for me too! Did you make a pull request?

lucabecchetti avatar Aug 10 '22 09:08 lucabecchetti

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

nea avatar Aug 10 '22 10:08 nea

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)))

ericmp33 avatar Oct 10 '22 11:10 ericmp33

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! ❤️

reinink avatar Jul 28 '23 01:07 reinink