-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: Pagination for other values in multi choice #1560
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
Multiple filesThe new constant name 'TEXT_RESPONSES_PER_PAGE' is more generic and improves the readability of the code. However, it's important to ensure that this change doesn't affect the functionality of the code, especially if there are other types of responses that should not be affected by this constant. // No changes are needed as the new constant name improves readability apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/OpenTextSummary.tsxIt's recommended to use the 'useReducer' hook instead of 'useState' when the new state depends on the previous one. This is because 'useState' may not immediately update the state and this could lead to stale state issues. 'useReducer' provides a more predictable state transition. const [displayCount, setDisplayCount] = useReducer((prevCount, newCount) => prevCount + newCount, responsesPerPage); MultipleChoiceSummary.tsxInstead of using the result.otherValues.reduce((acc, otherValue, idx) => {
if (otherValue !== "" && acc.length < otherDisplayCount) {
acc.push(otherValue);
}
return acc;
}, []) Instead of using an if-else statement to determine the text to display based on the count, you can use a ternary operator. This will make your code more concise and easier to read. <p className="flex w-full pt-1 text-slate-600 sm:items-end sm:justify-end sm:pt-0">
{result.count} {result.count === 1 ? "response" : "responses"}
</p> packages/lib/constants.tsInstead of calculating the file size limits each time they are accessed, you can calculate them once and store the results in constants. This will slightly improve the performance of your code. const MB = 1024 * 1024;
const GB = MB * 1024;
export const MAX_SIZES = {
public: MB * 10, // 10MB
free: MB * 10, // 10MB
pro: GB, // 1GB
} as const; Consider renaming the constant export const MAX_TEXT_RESPONSES_PER_PAGE = 5; |
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.
🚀
* main: (42 commits) chore: add revert to oss-friends (formbricks#745) fix: pass authOptions to getServerSession in authLayout (formbricks#1584) fix: fixed URL example for "Create Survey" API endpoint is wrong formbricks#1555 (formbricks#1586) fix(docs): default account info docs changes (formbricks#1583) chore: Add docker packages to Github Packages on release (formbricks#1585) feat: avatar upload (formbricks#1546) fix: editor crashing (formbricks#1582) fix: Add scroll to the setting navbar (formbricks#1398) are you sure modal missing fix:formbricks#1419 (formbricks#1485) fix: github linting issues (formbricks#1510) refactor: added authorization to airtable integration and create a common actions file (formbricks#1538) docs: add docs for airtable (formbricks#1541) fix: missing static generation store in revalidation due to pages dir (formbricks#1581) feat: Pagination for other values in multi choice (formbricks#1560) feat: $199 pricing model for unlimited plans (formbricks#1564) fix: make pricing pages consistent (formbricks#1567) fix: openText issue (formbricks#1579) fix: avoid blocking the request if it does not have an associated ip (formbricks#1540) feat: Add Unkey to OSS Friends (formbricks#1574) feat: FOR-683 Role Switch (formbricks#1450) ...
* main: (70 commits) chore: add revert to oss-friends (formbricks#745) fix: pass authOptions to getServerSession in authLayout (formbricks#1584) fix: fixed URL example for "Create Survey" API endpoint is wrong formbricks#1555 (formbricks#1586) fix(docs): default account info docs changes (formbricks#1583) chore: Add docker packages to Github Packages on release (formbricks#1585) feat: avatar upload (formbricks#1546) fix: editor crashing (formbricks#1582) fix: Add scroll to the setting navbar (formbricks#1398) are you sure modal missing fix:formbricks#1419 (formbricks#1485) fix: github linting issues (formbricks#1510) refactor: added authorization to airtable integration and create a common actions file (formbricks#1538) docs: add docs for airtable (formbricks#1541) fix: missing static generation store in revalidation due to pages dir (formbricks#1581) feat: Pagination for other values in multi choice (formbricks#1560) feat: $199 pricing model for unlimited plans (formbricks#1564) fix: make pricing pages consistent (formbricks#1567) fix: openText issue (formbricks#1579) fix: avoid blocking the request if it does not have an associated ip (formbricks#1540) feat: Add Unkey to OSS Friends (formbricks#1574) feat: FOR-683 Role Switch (formbricks#1450) ...
What does this PR do?
Fixes 1466
Screen.Recording.2023-11-02.at.6.25.41.PM.mov
Type of change
How should this be tested?
Check summary for multi choice with other enabled
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated