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: lint warnings #2201

Merged
merged 1 commit into from
Mar 7, 2024
Merged

fix: lint warnings #2201

merged 1 commit into from
Mar 7, 2024

Conversation

Dhruwang
Copy link
Contributor

@Dhruwang Dhruwang commented Mar 7, 2024

What does this PR do?

Fixes some lint warnings and removes a console log from summary page

How should this be tested?

pnpm run lint

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

Copy link

vercel bot commented Mar 7, 2024

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

2 Ignored Deployments
Name Status Preview Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Mar 7, 2024 0:58am
formbricks-com ⬜️ Ignored (Inspect) Mar 7, 2024 0:58am

Copy link
Contributor

github-actions bot commented Mar 7, 2024

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

Copy link
Contributor

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

Consider using the useCallback hook for the functions that are being passed as props to child components. This will prevent unnecessary re-renders of those components when the parent component re-renders.
Create Issue
See the diff
Checkout the fix

    const handleSurveyCompletion = useCallback(() => {
      setFade(false);

      setTimeout(() => {
        setIframeVisible(false); // Hide the iframe after fade-out effect is complete
        setCurrentStep(5); // Assuming you want to move to the next step after survey completion
      }, 1000); // Adjust timeout duration based on your fade-out CSS transition
    }, []);

    const handleMessageEvent = useCallback((event: MessageEvent) => {
      if (event.origin !== webAppUrl) return;

      if (event.data === "formbricksSurveyCompleted") {
        handleSurveyCompletion();
      }
    }, [webAppUrl, handleSurveyCompletion]);
git fetch origin && git checkout -b ReviewBot/Impro-haau8nc origin/ReviewBot/Impro-haau8nc

apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.tsx

Consider refactoring the handleDateChange and handleDateHoveredChange functions to reduce their complexity. Currently, these functions contain a lot of similar code for handling the 'from' and 'to' dates. You could create a helper function that handles the common logic and call this function in handleDateChange and handleDateHoveredChange.
Create Issue
See the diff
Checkout the fix

    const handleDate = (date: Date, selectingDate: DateSelected) => {
      const newDate = new Date(date);
      newDate.setHours(selectingDate === DateSelected.FROM ? 0 : 23, selectingDate === DateSelected.FROM ? 0 : 59, 0, selectingDate === DateSelected.FROM ? 0 : 999);
      return newDate;
    };

    const handleDateChange = (date: Date) => {
      const newDate = handleDate(date, selectingDate);
      // Rest of the code...
    };

    const handleDateHoveredChange = (date: Date) => {
      const newDate = handleDate(date, selectingDate);
      // Rest of the code...
    };
git fetch origin && git checkout -b ReviewBot/Impro-wbx0n4p origin/ReviewBot/Impro-wbx0n4p

@jobenjada jobenjada added this pull request to the merge queue Mar 7, 2024
Merged via the queue into main with commit 82124a8 Mar 7, 2024
14 of 16 checks passed
@jobenjada jobenjada deleted the lint-warnings branch March 7, 2024 14:47
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

2 participants