Skip to content

Conversation

@alen420
Copy link

@alen420 alen420 commented May 6, 2025

āœļøā€ÆProblem Description
The Cusdis comment widget doesn’t respect the site’s theme setting:

  1. Initial render – Cusdis always receives "auto" and falls back to its default colors, so it may mismatch the rest of the page.

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

@vercel
Copy link

vercel bot commented May 6, 2025

@aron5055 is attempting to deploy a commit to the Osmium Team on Vercel.

A member of the Team first needs to authorize it.

@alen420 alen420 changed the title Fix typo in appearance property in ThemeProvider šŸ› fix(theme): typo & Cusdis dark‑mode sync May 6, 2025
Copy link
Collaborator

@SilentDepth SilentDepth left a 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";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
import { useTheme } from "@/contexts/theme";
import { useTheme } from '@/contexts/theme'

pageTitle: post.title,
pageUrl: link + router.asPath,
theme: appearance,
theme: scheme,
Copy link
Collaborator

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?

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants