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: infinite loop in onboarding #1604

Merged
merged 2 commits into from
Nov 10, 2023
Merged

fix: infinite loop in onboarding #1604

merged 2 commits into from
Nov 10, 2023

Conversation

mattinannt
Copy link
Member

What does this PR do?

fix: infinite loop in onboarding

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change adds a new database migration
  • This change requires a documentation update

Copy link

vercel bot commented Nov 10, 2023

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) Visit Preview Nov 10, 2023 10:56am
formbricks-com ⬜️ Ignored (Inspect) Visit Preview Nov 10, 2023 10:56am

Copy link
Contributor

github-actions bot commented Nov 10, 2023

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

Copy link
Contributor

apps/web/app/(app)/onboarding/components/Objective.tsx

Instead of using the find method to get the selected objective or role, you can use a JavaScript object to map the labels to their corresponding ids. This will improve the performance from O(n) to O(1) and make the code more readable.
Create Issue

    const objectives = {
      "Increase conversion": "increase_conversion",
      "Improve user retention": "improve_user_retention",
      "Increase user adoption": "increase_user_adoption",
      "Sharpen marketing messaging": "sharpen_marketing_messaging",
      "Support sales": "support_sales",
      "Other": "other",
    };

    const handleNextClick = async () => {
      if (selectedChoice) {
        const selectedObjectiveId = objectives[selectedChoice];
        if (selectedObjectiveId) {
          // ...
        }
      }
    };

apps/web/app/(app)/onboarding/components/Role.tsx

Similar to the previous suggestion, you can use a JavaScript object to map the labels to their corresponding ids for roles. This will improve the performance from O(n) to O(1) and make the code more readable.
Create Issue

    const roles = {
      "Project Manager": "project_manager",
      "Engineer": "engineer",
      "Founder": "founder",
      "Marketing Specialist": "marketing_specialist",
      "Other": "other",
    };

    const handleNextClick = async () => {
      if (selectedChoice) {
        const selectedRoleId = roles[selectedChoice];
        if (selectedRoleId) {
          // ...
        }
      }
    };

@mattinannt mattinannt added this pull request to the merge queue Nov 10, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 10, 2023
@mattinannt mattinannt added this pull request to the merge queue Nov 10, 2023
Merged via the queue into main with commit c2675a9 Nov 10, 2023
11 checks passed
@mattinannt mattinannt deleted the feautre/fix-onboarding branch November 10, 2023 11:07
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