-
Notifications
You must be signed in to change notification settings - Fork 54
š fix(theme): typo & Cusdis darkāmode sync #21
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
base: main
Are you sure you want to change the base?
Conversation
|
@aron5055 is attempting to deploy a commit to the Osmium Team on Vercel. A member of the Team first needs to authorize it. |
SilentDepth
left a comment
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.
Thanks for your contribution! Just left a few comments.
| import { ReactCusdis } from 'react-cusdis' | ||
| import { useRouter } from 'next/router' | ||
| import { useConfig } from '@/contexts/config' | ||
| import { useTheme } from "@/contexts/theme"; |
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.
| import { useTheme } from "@/contexts/theme"; | |
| import { useTheme } from '@/contexts/theme' |
| pageTitle: post.title, | ||
| pageUrl: link + router.asPath, | ||
| theme: appearance, | ||
| theme: scheme, |
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.
I see Cusdis does support an auto value. Wouldnāt it be better to use appearance here?
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.
However, it doesn't work during actual deployment. I have no idea why, but passing 'auto' defaults to the light theme.
āļøāÆProblem Description
The Cusdis comment widget doesnāt respect the siteās theme setting:
Initial render ā Cusdis always receives "auto" and falls back to its default colors, so it may mismatch the rest of the page.
Theme toggle ā When the user switches between lightāÆ/āÆdark, Cusdis doesnāt update and sometimes freezes (the iframe stays mounted with the old styles).
š§āÆWhat This Patch Does
Fetches the resolved scheme ('light'āÆorāÆ'dark') from useTheme() instead of passing the raw appearance config.
Adds a key={\cusdis-${scheme}
}prop, forcing React to remount the widget whenever the scheme changes. This refreshes the iframe and eliminates the freeze.