epicweb-dev / full-stack-foundations

Learn the foundational skills of building full stack web applications.

Home Page:https://epicweb.dev/workshops/full-stack-foundations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

phunkren opened this issue · comments

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

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.

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).

@kentcdodds awesome! Thank you 😊

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

Ah, great!