Skip to content

bug:DOMTokenList error#224

Merged
fahimahammed merged 5 commits intofahimahammed:stagefrom
kunal-10-cloud:DOMTokenList#223
Oct 20, 2025
Merged

bug:DOMTokenList error#224
fahimahammed merged 5 commits intofahimahammed:stagefrom
kunal-10-cloud:DOMTokenList#223

Conversation

@kunal-10-cloud
Copy link
Contributor

@kunal-10-cloud kunal-10-cloud commented Oct 18, 2025

Fixes: #223

Description

This PR fixes the DOMTokenList error that occurs when running npm run dev. The error was caused by theme names containing spaces (like "Default Theme") being passed to the next-themes library, which tries to add them as CSS class tokens. CSS class tokens cannot contain spaces or special characters, causing the application to fail to start properly.

Changes Made

[x] Added custom storageKey="devui-theme" to ThemeProvider in src/app/layout.tsx
[x] Implemented theme name validation and cleanup logic in src/components/ui/ThemeColorPicker.tsx
[x] Added automatic removal of invalid theme names from localStorage on component mount
[x] Enhanced theme name validation using regex /[^a-zA-Z0-9-_]/g to remove invalid characters
[x] Added cleanup for both custom and next-themes localStorage keys

Screenshots or GIFs (if applicable)

Before:
Screenshot 2025-10-18 at 2 47 21 PM

After:
Screenshot 2025-10-18 at 2 46 59 PM

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Great job, @kunal-10-cloud! Thanks for creating the pull request.
Soon the maintainers/owner will review it and provide you with feedback/suggestions.
Make sure to star this awesome repository and follow the account!

  • DevUI

@kunal-10-cloud
Copy link
Contributor Author

@fahimahammed could you please take a look on this issue and the pr and suggest me any changes required

Copy link
Owner

@fahimahammed fahimahammed left a comment

Choose a reason for hiding this comment

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

resolve merge conflict

Copy link
Owner

@fahimahammed fahimahammed left a comment

Choose a reason for hiding this comment

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

thank you

>
{/* Wrap everything in ThemeProvider */}
<ThemeProvider attribute="class" defaultTheme="dark" enableSystem>
{/* Wrap everything in ThemeProvider */}
Copy link
Owner

Choose a reason for hiding this comment

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

approved. thank you

@fahimahammed fahimahammed merged commit a983158 into fahimahammed:stage Oct 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Fix DOMTokenList error caused by theme names containing spaces

2 participants