-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: no owners on template error when loading unsaved draft form #4195
Conversation
🧪 Review environmenthttps://bsnr3umip7ih4rswhw4xsdqphu0vnpek.lambda-url.ca-central-1.on.aws/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I tested it locally and I did not find any issue.
@@ -46,10 +46,6 @@ export default async function Layout({ | |||
if (initialForm === null) { | |||
redirect(`/${locale}/404`); | |||
} | |||
|
|||
if (initialForm.isPublished) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bryan-robitaille how did you catch this? I ran multiple tests locally and I did not notice anything wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cypress was throwing an error when it was trying to load the settings pages with a published form. Any form that is published with the old logic would just keep redirecting to the /settings page in an infinite loop.
Summary | Résumé
This PR fixes a bug where an error was being thrown when a user accesses the responses page directly when using the "0000" temporary form ID. This use case was probably occurring when a user bookmarked the responses page with the "0000" id in the url.
The logic set to redirect a user at the layout level was wrapped in a try / catch which did not allow the
redirect
to properly bubble up to the NextJS Router.The
fetchSubmissions
function was also checking for a formID of "0000" to short circuit but undefined was being passed in as it is the value stored in the TemplateStore for a draft form.A small refactor was done on
getUnprocessedSubmissionsForUser
inlib/users
to remove an unused argument that was never referenced in the codebase.Test instructions | Instructions pour tester la modification
Unresolved questions / Out of scope | Questions non résolues ou hors sujet
There is still an issue where the "0000" remains in the URL even though the session storage has been updated with a proper form ID.
Pull Request Checklist
Please complete the following items in the checklist before you request a review: