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

fix: unable to save legacy surveys #2280

Merged
merged 1 commit into from
Mar 19, 2024
Merged

Conversation

mattinannt
Copy link
Member

What does this PR do?

fix: unable to save legacy surveys

Copy link

vercel bot commented Mar 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Mar 19, 2024 8:32am
formbricks-com ⬜️ Ignored (Inspect) Visit Preview Mar 19, 2024 8:32am

Copy link
Contributor

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

packages/lib/utils/validate.ts

It would be more readable if the error message included the name of the schema that failed validation, rather than the entire schema object. This would make the error message more concise and easier to understand.
Create Issue
See the diff
Checkout the fix

    `Validation failed for ${JSON.stringify(value, null, 2)} and ${schema.name}: ${inputValidation.error.message}`
git fetch origin && git checkout -b ReviewBot/Impro-3p8ms9w origin/ReviewBot/Impro-3p8ms9w

packages/lib/constants.ts

Increasing the revalidation interval from 30 minutes to 3 hours might not be the best solution for all cases. If the data changes frequently, this could lead to outdated data being served to the users. Consider implementing a more dynamic revalidation strategy, such as using webhooks or event-driven updates, to ensure data freshness without unnecessary revalidations.
Create Issue
See the diff
Checkout the fix

    // Implement a dynamic revalidation strategy
git fetch origin && git checkout -b ReviewBot/Impro-xhzwtq5 origin/ReviewBot/Impro-xhzwtq5

@@ -10,7 +10,7 @@ export const validateInputs = (...pairs: ValidationPair[]): void => {

if (!inputValidation.success) {
console.error(
`Validation failed for ${value} and ${JSON.stringify(schema)}: ${inputValidation.error.message}`
`Validation failed for ${JSON.stringify(value, null, 2)} and ${JSON.stringify(schema)}: ${inputValidation.error.message}`
Copy link
Contributor

Choose a reason for hiding this comment

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

The error message has been updated to include only the name of the schema that failed validation, making it more concise and easier to understand.

Suggested change
`Validation failed for ${JSON.stringify(value, null, 2)} and ${JSON.stringify(schema)}: ${inputValidation.error.message}`
console.error(
`Validation failed for ${JSON.stringify(value, null, 2)} and ${schema.name}: ${inputValidation.error.message}`
);

Comment on lines 6 to +7
export const REVALIDATION_INTERVAL = 0; //TODO: find a good way to cache and revalidate data when it changes
export const SERVICES_REVALIDATION_INTERVAL = 60 * 30; // 30 minutes
export const SERVICES_REVALIDATION_INTERVAL = 60 * 60 * 3; // 3 hours
Copy link
Contributor

Choose a reason for hiding this comment

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

Implement a dynamic revalidation strategy to ensure data freshness without unnecessary revalidations.

Suggested change
export const REVALIDATION_INTERVAL = 0; //TODO: find a good way to cache and revalidate data when it changes
export const SERVICES_REVALIDATION_INTERVAL = 60 * 30; // 30 minutes
export const SERVICES_REVALIDATION_INTERVAL = 60 * 60 * 3; // 3 hours
// TODO: Implement a dynamic revalidation strategy to ensure data freshness without unnecessary revalidations.
export const REVALIDATION_INTERVAL = 0;
export const SERVICES_REVALIDATION_INTERVAL = 60 * 60 * 3; // 3 hours

@mattinannt mattinannt added this pull request to the merge queue Mar 19, 2024
Merged via the queue into main with commit 6c84850 Mar 19, 2024
14 of 16 checks passed
@mattinannt mattinannt deleted the feature/survey-update-fix branch March 19, 2024 09:11
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.

None yet

1 participant