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

Fully handle booking pages with conflicting themes being opened together #8921

Merged
merged 3 commits into from May 16, 2023

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented May 16, 2023

What does this PR do?

Fixes #8860
Fixes CAL-1659

Embed Theme Infinite Flicker when 2 embeds using same namespace try to use different themes simultaneously

Before:
https://www.loom.com/share/717539d93b2f46d5a220b7877f5fdf14

After:
https://www.loom.com/share/85e31e52ee1c4b0781e13e3be380a2ff

Booking Page Theme Switch when interacting with another Booking page (with different theme)

Before:
https://www.loom.com/share/9793f935eff047cf8e57c8c291b49371

After:
https://www.loom.com/share/9731a33ccc3b47969c4622ca15bebeb1

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

See the loom

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works

@hariombalhara hariombalhara requested a review from a team May 16, 2023 07:50
@vercel
Copy link

vercel bot commented May 16, 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 May 16, 2023 7:22pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
ui ⬜️ Ignored (Inspect) Visit Preview May 16, 2023 7:22pm

@socket-security
Copy link

socket-security bot commented May 16, 2023

No dependency changes detected. Learn more about Socket for GitHub ↗︎


👍 No dependency changes detected in pull request

Pull request alert summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

@github-actions
Copy link
Contributor

github-actions bot commented May 16, 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 May 16, 2023

Current Playwright Test Results Summary

✅ 112 Passing - ⚠️ 3 Flaky

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

(Last updated on 05/16/2023 07:41:12pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 2599005

Started: 05/16/2023 07:31:51pm UTC

⚠️ Flakes

📄   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
0% (0) 0 / 336 runs
failed over last 7 days
5.06% (17) 17 / 336 runs
flaked over last 7 days

📄   apps/web/playwright/booking-seats.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking with Seats -- new-booker Reschedule for booking with seats -- old-booker Should reschedule booking with seats and if everyone rescheduled it should be deleted
Retry 1Initial Attempt
0% (0) 0 / 349 runs
failed over last 7 days
77.08% (269) 269 / 349 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.test.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
10.86% (19) 19 / 175 runs
failed over last 7 days
48.57% (85) 85 / 175 runs
flaked over last 7 days

View Detailed Build Results


@hariombalhara hariombalhara force-pushed the fix/infinite-theme-flickering branch from 50de55c to 5ccc3e1 Compare May 16, 2023 08:28
@linear
Copy link

linear bot commented May 16, 2023

CAL-1659 Light Mode-Dark Mode flicker in embed

https://share.getcloudapp.com/OAuo5xgZ
If Cal is embedded on a site and open in dark theme mode, but a second page in the same (Chrome) browser is open with Cal embedded (in white theme mode), the colors of the black Cal embeds start flickering from black to white continuously in seconds.
Screen Recording 2023-05-12 at 09.31.53 AM

// Use namespace of embed to ensure same namespaced embed are displayed with same theme. This allows different embeds on the same website to be themed differently
// One such example is our Embeds Demo and Testing page at http://localhost:3100
// Having `getEmbedNamespace` defined on window before react initializes the app, ensures that embedNamespace is available on the first mount and can be used as part of storageKey
const embedNamespace = typeof window !== "undefined" ? window.getEmbedNamespace() : null;
const isEmbedMode = typeof embedNamespace === "string";

const storageKey = isEmbedMode
Copy link
Member Author

Choose a reason for hiding this comment

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

Abstracted out this theme specific code, which was a lot to a separate fn.

const appearanceBasis = props.appearanceBasis;

if ((isBookingPageThemSupportRequired || isEmbedMode) && !appearanceBasis) {
console.warn(
Copy link
Member Author

Choose a reason for hiding this comment

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

Added everywhere, but just in case it's missed, there would be a warning.

Copy link
Member

@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.

Ship it

@@ -140,6 +106,100 @@ const CalcomThemeProvider = (
);
};

/**
* The most important job for this fn is to generate correct storageKey for theme persistenc.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* The most important job for this fn is to generate correct storageKey for theme persistenc.
* The most important job for this fn is to generate correct storageKey for theme persistence.

Copy link
Member

@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.

Ship it

@zomars zomars enabled auto-merge May 16, 2023 19:18
@zomars zomars added this pull request to the merge queue May 16, 2023
Merged via the queue into main with commit f881061 May 16, 2023
20 checks passed
@zomars zomars deleted the fix/infinite-theme-flickering branch May 16, 2023 20:05
sean-brydon pushed a commit that referenced this pull request May 18, 2023
…her (#8921)

* Handle booking pages with conflicting themes being opened together

* Add comments

---------

Co-authored-by: Omar López <zomars@me.com>
@PeerRich PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-1659] Light Mode-Dark Mode flicker in embed
3 participants