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: Prevents undefined features flags on first render #9374

Merged
merged 3 commits into from
Jun 7, 2023

Conversation

zomars
Copy link
Member

@zomars zomars commented Jun 7, 2023

What does this PR do?

This allows feature flags to be prefetched on most pages. You still need to use getServerSideProps and ssrInit helper in order to benefit from this.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)

How should this be tested?

  • On any page with ssrInit try using const featureFlags = useFlagMap();
  • It should never return an empty object.

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

@vercel
Copy link

vercel bot commented Jun 7, 2023

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

Name Status Preview Comments Updated (UTC)
cal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2023 0:44am
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2023 0:44am
website ❌ Failed (Inspect) Jun 7, 2023 0:44am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api ⬜️ Ignored (Inspect) Jun 7, 2023 0:44am
ui ⬜️ Ignored (Inspect) Visit Preview Jun 7, 2023 0:44am

Copy link
Member Author

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Self review done

@@ -26,6 +26,8 @@ export async function ssrInit(context: GetServerSidePropsContext) {

// always preload "viewer.public.i18n"
await ssr.viewer.public.i18n.fetch();
// So feature flags are available on first render
Copy link
Member Author

Choose a reason for hiding this comment

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

I chose this common helper instead of each individual page because prefetched feature flags would be desirable in most cases.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 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! 🙌

@deploysentinel
Copy link

deploysentinel bot commented Jun 7, 2023

Current Playwright Test Results Summary

✅ 107 Passing - ⚠️ 4 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 06/07/2023 12:45:51am UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: d4c24af

Started: 06/07/2023 12:43:41am UTC

⚠️ Flakes

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should be able to reschedule
Retry 2Retry 1Initial Attempt
7.32% (15) 15 / 205 runs
failed over last 7 days
92.68% (190) 190 / 205 runs
flaked over last 7 days

📄   apps/web/playwright/event-types.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Event Types tests user -- old-booker can add multiple organizer address
Retry 1Initial Attempt
4.11% (13) 13 / 316 runs
failed over last 7 days
2.53% (8) 8 / 316 runs
flaked over last 7 days

📄   apps/web/playwright/login.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
user can login & logout succesfully login flow user & logout using dashboard
Retry 1Initial Attempt
0.30% (1) 1 / 336 run
failed over last 7 days
7.44% (25) 25 / 336 runs
flaked over last 7 days

📄   apps/web/playwright/auth/delete-account.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Can delete user account
Retry 1Initial Attempt
0.88% (3) 3 / 339 runs
failed over last 7 days
1.47% (5) 5 / 339 runs
flaked over last 7 days

View Detailed Build Results


Copy link
Contributor

@roae roae left a comment

Choose a reason for hiding this comment

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

LGTM! 🙏

Merged via the queue into main with commit 9af6212 Jun 7, 2023
@zomars zomars deleted the fix/preload-feature-flags branch June 7, 2023 02:14
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.

2 participants