You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
both index.svelte and next.svelte are slightly modified copies of the default App.svelte content.
index.svelte
<script lang="ts">
export let currentRoute: any;
export let params: any;
console.log(params);
</script>
<main>
<h1>Hello {currentRoute.namedParams.name}!</h1>
<p>Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn how to build Svelte apps.</p>
<p>index.svelte</p>
</main>
...
next.svelte
...
<main>
<h1>Hello {currentRoute.namedParams.name} {currentRoute.namedParams.last} !</h1>
<p>Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn how to build Svelte apps.</p>
<p>next.svelte</p>
</main>
...
Test were run on Google Chrome (Linux) 89.0.4389.114
Problems with route /:name
First Using url (http://localhost:5000/) results in "HELLO /!":
ERROR: Output was "HELLO /!" expected something like "HELLO UNDEFINED!" since no value was passed in for parameter :name
Browser history/url is modified to http://localhost:5000missing the leading slash. Not a major problem since it means the same thing
Second Problem url (http://localhost:5000/:test):
CORRECT: Output "HELLO :TEST!"
ERROR: Browser history/url is modified to http://localhost:5000, which is not the same thing.
Correct Results as exemplified by url (http://localhost:5000/&name):
Output "HELLO &NAME!"
Browser history/url not modified
The text was updated successfully, but these errors were encountered:
Hi,
I'm having a problem with route determination and named parameters.
Actually I have several problems, but I will write up an issue per problem.
This initial issue describes the test environment.
I did this on a brand new project (svelte typescript) and modified the project to add a route for testing.
to setup the project I did the following (as per the svelte guide):
I'm using the latest 6.0.1 version of the router.
I basically modified the App.svelte to read
defined routes.ts as
both index.svelte and next.svelte are slightly modified copies of the default App.svelte content.
index.svelte
next.svelte
Test were run on Google Chrome (Linux) 89.0.4389.114
Problems with route /:name
First Using url (
http://localhost:5000/
) results in "HELLO /!"::name
http://localhost:5000
missing the leading slash. Not a major problem since it means the same thingSecond Problem url (
http://localhost:5000/:test
):http://localhost:5000
, which is not the same thing.Correct Results as exemplified by url (
http://localhost:5000/&name
):The text was updated successfully, but these errors were encountered: