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): Conform theme logic with OS theme preference #6138

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

demakoff
Copy link
Contributor

Description

It looks like after these changes in themeProvider.tsx initial conformity between app theme and OS theme preference was broken, so the app completely disregarded OS level theme user preference having a dark theme as default always.

Validation

Before:

os_pref_theme_before

After:

os_pref_theme_after

Related Issues

The issue was introduced here #6092

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npx turbo lint to ensure the code follows the style guide. And run npx turbo lint:fix to fix the style errors if necessary.
  • I have run npx turbo format to ensure the code follows the style guide.
  • I have run npx turbo test to check if all tests are passing.
  • I've covered new added functionality with unit tests if necessary.

@demakoff demakoff requested a review from a team as a code owner November 23, 2023 16:03
Copy link

vercel bot commented Nov 23, 2023

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

Name Status Preview Comments Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 23, 2023 4:05pm

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

What is resolvedTheme? Does this fix the issue of when using system theme detection it not providing the correct theme?

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you for your first contribution :)

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Nov 23, 2023
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Nov 23, 2023
Copy link

github-actions bot commented Nov 23, 2023

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 100 🟢 97 🟠 83 🟢 92 🔗
/en/about 🟢 100 🟢 95 🟠 83 🟢 92 🔗
/en/about/previous-releases 🟢 100 🟢 93 🟢 92 🟢 92 🔗
/en/download 🟢 100 🟢 95 🟢 92 🟢 92 🔗
/en/blog 🟢 99 🟢 95 🟠 83 🟢 92 🔗

Copy link

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 87%
82.91% (398/480) 70.16% (87/124) 69.14% (65/94)

Unit Test Report

Tests Skipped Failures Errors Time
71 0 💤 0 ❌ 0 🔥 5.543s ⏱️

@demakoff
Copy link
Contributor Author

What is resolvedTheme? Does this fix the issue of when using system theme detection it not providing the correct theme?

From the next-themes docs:

resolvedTheme: If enableSystem is true and the active theme is "system", this returns whether the system preference resolved to "dark" or "light". Otherwise, identical to theme

Talking about incorrect theme detection I have nothing to say 🤷🏻‍♂️ , if you have any details, let's consider 👍🏻

@ovflowd
Copy link
Member

ovflowd commented Nov 23, 2023

I'm fast-tracking this as a nice one-liner bug fix.

@ovflowd ovflowd added this pull request to the merge queue Nov 23, 2023
Merged via the queue into nodejs:main with commit 5882ccb Nov 23, 2023
15 checks passed
@ovflowd ovflowd added the fast-track Fast Tracking PRs label Nov 23, 2023
@ovflowd
Copy link
Member

ovflowd commented Nov 23, 2023

Again, thank you for the contribution, @demakoff! Super appreciate it!

@demakoff
Copy link
Contributor Author

@ovflowd Thanks a lot, Claudio 🤝

@demakoff demakoff deleted the enable-system-theme branch November 27, 2023 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fast-track Fast Tracking PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants