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.

`replace` triggers `DOMException`

See original GitHub issue

I noticed my browser did weird things when I used the replace function provided by svelte-spa-router. In my case the route was somehow duplicated and I tried to reproduce this with a minimal example in the Svelte Repl.

In the Svelte Repl, when trying to navigate with replace, just a DOMException is thrown. This does not seem to be expected behavior (if I read the documentation correctly):

https://svelte.dev/repl/1321fcda2b774b6e9a13146358ebfcec?version=3.20.1

issue as screenshot

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ItalyPaleAlecommented, Mar 18, 2020

What do you mean with “route duplication issue”?

Anyways, thanks for confirming this is an issue with the REPL. I think I can make a code change to detect that scenario and issue a warning in the console, to make the DX a bit better.

1reaction
ItalyPaleAlecommented, Mar 18, 2020

All navigation method (push, pop, replace) already wait for the next tick: https://github.com/ItalyPaleAle/svelte-spa-router/blob/master/Router.svelte#L120

So, await’ing in your code shouldn’t be necessary, unless you are doing some async work yourself…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught (in promise) DOMException: play() failed because ...
I encountered a similar error with while attempting to play an audio file. At first, it was working, then it stopped working when...
Read more >
Failed to execute 'replaceState' on 'History': #<Object> could ...
I think the issue is because of trying to push a complex object into the page state. Once I replaced the page state...
Read more >
DOMException - Web APIs | MDN
DOMException is a Serializable object, so it can be cloned with structuredClone() or copied between Workers using postMessage() . Constructor.
Read more >
Javascript – 'DOMException: Failed to execute 'querySelectorAll' on ...
Javascript – 'DOMException: Failed to execute 'querySelectorAll' on 'Element' when ... selected); // Trigger onchange() event $select.trigger('change'); ...
Read more >
failed to execute 'open' on 'xmlhttprequest': invalid url - You.com
I get this error : DOMException: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL. I read I need to replace the port by...
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