Skip to content

Conversation

@alaninnovates
Copy link
Contributor

When a user creates a new devlog with an error and reloads the page, the route will not 404 anymore.
Current behavior:

  • User submits the devlog creation form with an error, posts to the url /projects/:project_id/devlogs
  • Server renders :new, but the url (without the /new) is changed. This leads to a 404 error on reload

Fixed behavior:

  • User submits the devlog creation form with an error, posts to the url /projects/:project_id/devlogs/new
  • Server renders :new, the url is preserved (with the /new) and there is no 404 error

The rationale for using the alias paths is that this allows the devlog text to be preserved on error, instead of clearing it with a redirect.

Video Demo
https://hackclub.enterprise.slack.com/files/U07B27ZHEJU/F0A5Q0FM2SX/screen_recording_2025-12-28_at_4.28.54___pm.mov

Resolves this Slack #flavortown-help ticket: https://hackclub.slack.com/archives/C09MATKQM8C/p1766465463434559
Additional details to this decision available in the thread

@maxwofford
Copy link
Member

interesting. i'm still a little confused why we need to change the routes & not just update the forms to handle this?

@alaninnovates
Copy link
Contributor Author

How would the form be updated to handle this? Sorry, newbie to rails here. The route I explored was making the create handler in the controller redirect to the /new page, but this would lead to the devlog text being lost. I'm not familiar, what other options are there? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants