epicweb-dev / full-stack-foundations

Learn the foundational skills of building full stack web applications.
https://epicweb.dev/workshops/full-stack-foundations
Other
586 stars 152 forks source link

[Routing] The relative link in the Adding Navigation Links exercise does not always return to users/kody #57

Closed phunkren closed 10 months ago

phunkren commented 10 months ago

As part of the exercise, we're tasked with creating a Link that navigates from the /users+/kody_+/notes page back to /users+/kody.

/** app/routes/users+/kody_+/notes  */
<Link to=".." relative="path" className="underline">
  Back to Kody
</Link>

However, if the user is on the nested notes.some-note-id route, the link will instead return them to the /users+/kody_+/notes route, instead of the desired /users+/kody. Is that the desired behaviour?

Current: /users/kody/notes -> users/kody\ /users/kody/notes/some-note-id -> /users/kody/notes

Expected: /users/kody/notes -> users/kody /users/kody/notes/some-note-id -> /users/kody

adebiyial commented 10 months ago

I might be ahead of myself here but if the dot-dot notation is akin to the terminal convention, then I'd say the current behavior should be expected, since it's like moving across nested levels, where the parent level changes contextually.

kentcdodds commented 10 months ago

Correct. It's not a bug in Remix, but it's a problem in my example. I'll evaluate the best way to explain this and update the instructions accordingly (and possibly re-record the video).

adebiyial commented 10 months ago

@kentcdodds awesome! Thank you 😊

kentcdodds commented 10 months ago

I've confirmed this is a bug in react router/remix. Will be opening an issue soon.

adebiyial commented 10 months ago

Ah, great!