router icon indicating copy to clipboard operation
router copied to clipboard

Path params are not UrlEncoded

Open JadenSHoward opened this issue 1 year ago • 0 comments

Describe the bug

If a path param has a character that gets urlEncoded (i.e. a , %, etc.), the page works fine on initial load, but upon refreshing, the path is not decoded (I think)

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-p58qkk?file=src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

  1. Go to Posts
  2. Go to any post
  3. Refresh the page

Expected behavior

The page reloads with no difference

Screenshots or Videos

What actually happens:

image

Platform

  • OS: [Linux]
  • Browser: [Chrome, and Firefox]
  • Version: [1.5.2]

Additional context

The changes to the app from the demo are

-    .then((r) => r.data.slice(0, 10))
-}
+    .then((r) =>
+      r.data.slice(0, 10).map((it) => ({ ...it, id: `${it.id} ${it.id}` }))
+    );
+};

-    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)
+    .get<PostType>(
+      `https://jsonplaceholder.typicode.com/posts/${postId.split(' ')[0]}`
+    )

JadenSHoward avatar Jan 17 '24 22:01 JadenSHoward