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

Optimize conditional rendering #9009

Merged
merged 3 commits into from May 22, 2023
Merged

Optimize conditional rendering #9009

merged 3 commits into from May 22, 2023

Conversation

Riyan-Mo
Copy link
Contributor

Declared a variable called isAdmin. The check session.data?.user.role === "ADMIN" is repeated multiple times. You can store this value in a variable to avoid redundant checks.

What does this PR do?

In the AppsLayout component, the emptyStore prop is used to conditionally render the EmptyScreen component. However, the check session.data?.user.role === "ADMIN" is repeated multiple times. You can store this value in a variable to avoid redundant checks.

Fixes # (issue)

Environment: Staging(main branch) / Production

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow 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 requires a documentation update

How should this be tested?

  • Test A
  • Test B

Checklist

  • I haven't commented my code, particularly in hard-to-understand areas

Declared a variable called isAdmin. The check session.data?.user.role === "ADMIN" is repeated multiple times. You can store this value in a variable to avoid redundant checks.
@vercel
Copy link

vercel bot commented May 20, 2023

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

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2023 6:27am

@vercel
Copy link

vercel bot commented May 20, 2023

@riyan911 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

github-actions bot commented May 20, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Removed extra line space to match prettier format
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

LGTM. I have fixed the lint errors

@Udit-takkar Udit-takkar added this pull request to the merge queue May 22, 2023
Merged via the queue into calcom:main with commit ccb7b1f May 22, 2023
20 checks passed
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