Skip to content
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

Add early return for responses page when a form hasn't been saved yet #3824

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

timarney
Copy link
Member

@timarney timarney commented Jun 12, 2024

Summary | Résumé

Fixes issue where a user could land on the responses page with a form that has never been saved (doesn't have form responses).

Adds early return to avoid API lookup which throws

Forms
- Template 0000 must have associated owners to access responses

Copy link
Contributor

@@ -38,6 +38,21 @@ export default async function Page({
overdueAfter: Number(await getAppSetting("nagwarePhaseEncouraged")),
};

// Handle the case where the user is not authenticated and the form ID is 0000
// In this case we know no responses will be returned, so we can skip the API call
if (isAuthenticated && id === "0000") {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check for a UUID vs just 0000

@timarney
Copy link
Member Author

Noting other string will still fall-through but will merge this.

@timarney timarney merged commit 88d95ba into develop Jun 12, 2024
13 checks passed
@timarney timarney deleted the fix/no-responses-api-lookup branch June 12, 2024 18:01
@dsamojlenko dsamojlenko changed the title fix: Add early return for responses page when a form hasn't been saved yet Add early return for responses page when a form hasn't been saved yet Jun 12, 2024
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