-
Notifications
You must be signed in to change notification settings - Fork 3k
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: dark-mode for scalar API docs when appearance is system settings #11085
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added dark mode support for the Scalar API documentation in the RestPlayground component, ensuring proper theme synchronization with system settings.
- Added
useColorMode
hook import from@scalar/use-hooks
inpackages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx
- Configured
darkMode
andforceDarkModeState
properties in ApiReferenceReact based on theme context - Implemented lazy loading of color mode hook to ensure proper theme initialization
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
import('@scalar/use-hooks/useColorMode').then((colorMode) => | ||
colorMode.useColorMode(), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: The useColorMode() hook is called immediately without being used, which may cause unnecessary re-renders
darkMode: theme.name === 'dark', | ||
baseServerURL: REACT_APP_SERVER_BASE_URL + '/' + schema, | ||
forceDarkModeState: theme.name === 'dark' ? 'dark' : 'light', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Redundant dark mode configuration - darkMode and forceDarkModeState properties serve the same purpose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- when using anyone of them: changing from dark to light mode works but from light to dark doesn't work as expected.
I cannot reproduce the original issue on main 🤔 |
So I'm sorry @Nabhag8848 I will just close this and this original issue. Thanks for digging into this! |
Issue
Demo
Screen.Recording.2025-03-21.at.3.23.06.PM.mov