Closed iancleary closed 6 days ago
personally I prefer contact to have an id
field and not a contactId
field, so I'd recommend the tutorial be updated to just use $id as the dynamic route parameter for contact and contact edit.
The request/bug is that they are not consistent and they should be.
Specifically https://remix.run/docs/en/main/start/tutorial#loading-data is when the conflict starts
Great work on remix, with the exception of the suspected bug, it seems (as someone who isn't primarily a front end developer) very well done. Thanks for everything you all do :)
Perhaps it's something with the parameter parsing, since $id in the file name worked fine, but it looks like the $contactId param should pass through just fine to the function to get a contact by id. Not sure why I had an issue
Perhaps it's something with the parameter parsing, since $id in the file name worked fine, but it looks like the $contactId param should pass through just fine to the function to get a contact by id. Not sure why I had an issue
Can you share a github repo with this issue?
I don't think there is a bug.
I think I messed up the spelling of contactId
between the name field on the params and the name of the file in the routes folder. My git local history didn't capture my mistake, but if I had to guess, I had something like contactID
in the filename (emphasis on capital D instead of lower case d). The app did show the error stack trace, but the tutorial doesn't show what that looks like, so I got derailed due to my suspected typo.
FWIW: https://github.com/iancleary/remix-tutorial-issue-9960/tree/main/app/routes is a repo without this issue.
Reproduction
Follow the tutorial
npx create-remix@latest --template remix-run/remix/templates/remix-tutorial
compare the route $contactId versus
id
field in the data.tsx fileSystem Info
Used Package Manager
pnpm
Expected Behavior
http://localhost:5173/contacts/alex-anderson resolves to find the contact by contactId
Actual Behavior
the tutorial fails to find params.contactId, since the data.tsx file uses id and not contactId as a