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: theme is not configured in app router #16889

Merged
merged 5 commits into from
Oct 1, 2024
Merged

Conversation

hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Oct 1, 2024

What does this PR do?

  • Fixes CAL-4336, CAL-4436
  • Loom

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

@graphite-app graphite-app bot requested a review from a team October 1, 2024 01:44
@keithwillcode keithwillcode added consumer core area: core, team members only labels Oct 1, 2024
@dosubot dosubot bot added the ui area: UI, frontend, button, form, input label Oct 1, 2024
Copy link

graphite-app bot commented Oct 1, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (10/01/24)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link

linear bot commented Oct 1, 2024

Copy link

vercel bot commented Oct 1, 2024

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Oct 1, 2024 5:01am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Oct 1, 2024 5:01am

Copy link
Contributor

github-actions bot commented Oct 1, 2024

E2E results are ready!

test.describe("Change Theme Test", () => {
test("change theme to dark", async ({ page, users }) => {
const pro = await users.create();
testBothFutureAndLegacyRoutes.describe("Change Theme Test", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding testBothFutureAndLegacyRoutes to test app router pages

Copy link
Contributor Author

@hbjORbj hbjORbj Oct 1, 2024

Choose a reason for hiding this comment

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

Can you turn APP_ROUTER_SETTINGS_MY_ACCOUNT_ENABLED to 1 for dev? @keithwillcode
Otherwise, testBothFutureAndLegacyRoutes will just test pages router twice

@@ -51,7 +51,7 @@ export function WithLayout<T extends Record<string, any>>({
requiresLicense={requiresLicense || !!(Page && "requiresLicense" in Page && Page.requiresLicense)}
nonce={nonce}
themeBasis={null}
isThemeSupported={!!(Page && "isThemeSupported" in Page && Page.isThemeSupported)}
isThemeSupported={Page && "isThemeSupported" in Page ? (Page.isThemeSupported as boolean) : undefined}
Copy link
Member

@sean-brydon sean-brydon Oct 1, 2024

Choose a reason for hiding this comment

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

NIT: I think isThemeSupported={Page?.isThemeSupported ?? undefined} has the same effect here and is a lot more readable

Suggested change
isThemeSupported={Page && "isThemeSupported" in Page ? (Page.isThemeSupported as boolean) : undefined}
isThemeSupported=isThemeSupported={Page?.isThemeSupported ?? undefined}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Page?.isThemeSupported will throw type error :( Feel free to make tweaks

Copy link
Member

@sean-brydon sean-brydon left a comment

Choose a reason for hiding this comment

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

LGTM - happy merging but i'd personally like to see the readability of that tenery improved

@hbjORbj hbjORbj merged commit b283f1f into main Oct 1, 2024
39 checks passed
@hbjORbj hbjORbj deleted the fix/theme-app-router branch October 1, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer core area: core, team members only ❗️ .env changes contains changes to env variables ready-for-e2e ui area: UI, frontend, button, form, input
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants