refactor(ui): decouple CSS dependencies and improve test quality#35242
Merged
refactor(ui): decouple CSS dependencies and improve test quality#35242
Conversation
- Inline Button @Utility classes into CVA, remove button/index.css and its globals.css import so the component is self-contained - Replace ScrollArea CSS Module with data-attribute selector (scroll-area.css) to eliminate CSS Module loader coupling - Remove base-ui identity tests (export === Base.X) from dialog, popover, tooltip, and number-field specs - Remove @/next/link external dependency from dropdown-menu spec - Remove redundant afterEach(cleanup) and unused beforeEach from specs - Update stale btn-* class assertions to actual design-token classes - Mark intentionally public re-exports with @public JSDoc for knip Made-with: Cursor
hyoban
previously approved these changes
Apr 15, 2026
Both are fully covered by their styled wrappers (DialogCloseButton and AlertDialogCancelButton) which use the same underlying base-ui primitive. Mark zero-consumer but intentionally public exports with @public JSDoc. Made-with: Cursor
The test file still imports it so knip does not flag it. Made-with: Cursor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #35242 +/- ##
==========================================
- Coverage 84.85% 84.85% -0.01%
==========================================
Files 4360 4360
Lines 196685 196683 -2
Branches 37281 37280 -1
==========================================
- Hits 166900 166895 -5
- Misses 26703 26706 +3
Partials 3082 3082
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
hyoban
approved these changes
Apr 15, 2026
HanqingZ
pushed a commit
to HanqingZ/dify
that referenced
this pull request
Apr 23, 2026
…ggenius#35242) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
asukaminato0721
pushed a commit
to asukaminato0721/dify
that referenced
this pull request
Apr 24, 2026
…ggenius#35242) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preliminary decoupling work for
web/app/components/base/ui/components to prepare for future@dify/uipackage extraction. This PR focuses exclusively on removing CSS coupling and improving test quality — no package extraction is performed.CSS Decoupling
@utilitydefinitions frombutton/index.cssinto CVA Tailwind classes, remove the CSS file and itsglobals.cssimport so the component is fully self-contained.index.module.css) with a plain CSS file using[data-dify-scrollbar]attribute selectors, eliminating CSS Module loader dependency while preserving style isolation.Test Quality Improvements
export === BaseXxx.Rootidentity tests from dialog, popover, tooltip, and number-field specs (implementation coupling, not bridging behavior).@/next/linkexternal project dependency from dropdown-menu spec.afterEach(cleanup)from button spec (already handled byvitest.setup.ts).beforeEach(vi.clearAllMocks)from number-field spec.btn-*class name assertions to actual design-token classes in alert-dialog and button specs.DialogTrigger,DialogClose,PopoverTitle,PopoverDescription) with@publicJSDoc for knip.All 13 test files (165 tests) pass. ESLint, TypeScript type-check, and knip all clean.
From Cursor.
Screenshots
No visual changes — CSS refactoring preserves identical rendered output.
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint godsMade with Cursor