question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to execute 'replaceState' on 'History': #<Object> with Sortable.js

See original GitHub issue

Versions:

  • vue version 3.0.5
  • @inertiajs/inertia version 0.9.0
  • @inertiajs/inertia-vue3 version 0.4.0

Describe the problem:

Similar to here, I have this problem when using Sortable.js / VueDraggable: https://github.com/inertiajs/inertia/issues/730

app.js?id=f8cbfda01b9810c19e0f:2 DOMException: Failed to execute 'replaceState' on 'History': #<Object> could not be cloned.
    at e.n.replaceState (/js/app.js?id=f8cbfda01b9810c19e0f:2:28191)
    at e.n.saveScrollPositions (/js/app.js?id=f8cbfda01b9810c19e0f:2:21087)
    at e.n.visit (/js/app.js?id=f8cbfda01b9810c19e0f:2:25155)
    at onClick (/js/app.js?id=f8cbfda01b9810c19e0f:2:11402)
    at At (/js/app.js?id=f8cbfda01b9810c19e0f:2:657430)
    at Pt (/js/app.js?id=f8cbfda01b9810c19e0f:2:657508)
    at HTMLAnchorElement.n (/js/app.js?id=f8cbfda01b9810c19e0f:2:708099)

Steps to reproduce:

Sort elements with sortable.js or Vue draggable and click on any Inertia link.

Similar to the linked thread, I can fix it by modifying the minified javascript file with this:

n.replaceState=function(e){this.page=e,e=JSON.parse(JSON.stringify(e)),window.history.replaceState(e,"",e.url)}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
SimonJcommented, Mar 31, 2022

I had the same issue. I fixed it by adding

onMounted(() => {
  JSON.parse(JSON.stringify(this.yourDATA))
})
3reactions
granthollecommented, Aug 24, 2021

After lots of work, I’ve found out that if you try to modify a prop directly in a component, it will cause this error. This tripped me up with object references (oh javascript). Cloning the prop I needed to do work on solved me issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inertia and Sortable.js (VueDraggable) - Laracasts
Uncaught DOMException: Failed to execute 'replaceState' on 'History': #<Object> could not be cloned. at e.n.replaceState (webpack-internal:///.
Read more >
Failed to execute 'replaceState' on 'History': #<Object> could ...
I have this Jetstream Laravel application, which has a presence channel set up for chat features. What's happening is: When I join the...
Read more >
Uncaught DOMException: Failed to execute 'pushState' on ...
This error occurs, as @Andreas mentioned in a comment, when DOM elements or anything non-serializable is used in the state object which is...
Read more >
5.4 Session history and navigation — HTML5 - W3C
History objects represent their browsing context's session history as a flat ... The pushState( data , title , url ) method adds a...
Read more >
Domexception: Failed To Execute 'Replacestate' On 'History'
SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL 'file://0.0.1.148/. Culprit: /enUS/fbevents.js in History.b.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found