Skip to content

fix: cssinjs should be hashed defaultly#55880

Merged
zombieJ merged 2 commits intomasterfrom
hashed
Nov 25, 2025
Merged

fix: cssinjs should be hashed defaultly#55880
zombieJ merged 2 commits intomasterfrom
hashed

Conversation

@zombieJ
Copy link
Member

@zombieJ zombieJ commented Nov 25, 2025

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English Fix ConfigProvider default not config theme.hashed is true which will cause style conflict with multiple versions.
🇨🇳 Chinese 修复 ConfigProvider 默认没有配置 theme.hashedtrue,从而会导致多版本混用样式冲突的问题。

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

Preview is ready

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

👁 Visual Regression Report for PR #55880 Failed ❌

🎯 Target branch: master (481ff1a)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 2 changed

Expected (Branch master) Actual (Current PR) Diff
select-basic.mobile.png select-basic.mobile.png select-basic.mobile.png select-basic.mobile.png
select-debug-flip-shift.dark.png select-debug-flip-shift.dark.png select-debug-flip-shift.dark.png select-debug-flip-shift.dark.png

Important

There are 2 diffs found in this PR: 🔄 2 changed.
Please check all items:

  • Visual diff is acceptable

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @zombieJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug in the ConfigProvider where the theme.hashed property was incorrectly defaulting to false. By changing this default to true, the PR ensures that the theme hashing mechanism is consistently enabled by default, aligning with the intended behavior and preventing potential styling discrepancies or issues that could arise from the previous default setting.

Highlights

  • Bug Fix: Corrected an issue where the ConfigProvider's theme.hashed property was not defaulting to true as expected.
  • Configuration Default: The hashed property within defaultConfig in components/theme/context.ts has been updated from false to true.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

发布说明

  • Chores

    • 更新 Ant Design CSS-in-JS 相关依赖版本
  • Refactor

    • 优化主题系统默认配置中的哈希处理
    • 改进组件样式选择器的动态组合方式

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

更新了主题配置和样式选择器,并提升了两个 CSS-in-JS 相关依赖版本:将默认主题配置 defaultConfig.hashedfalse 改为 true,在 GlobalLayout 中移除了显式 hashed: false,调整了 Mentions 后缀选择器为基于组件类名的动态选择器,并升级了 @ant-design/cssinjs@ant-design/cssinjs-utils 版本。

Changes

内聚体 / 文件(s) 变更摘要
主题默认配置
components/theme/context.ts
导出常量 defaultConfighashed 值由 false -> true
布局配置移除显式 hashed
.dumi/theme/layouts/GlobalLayout.tsx
在 useMemo 返回的 ThemeConfig 中移除显式 hashed: false 字段(不再在此处显式设置 hashed)
Mentions 样式选择器调整
components/mentions/style/index.ts
将后缀选择器从 &-suffix 改为基于组件类名的模板选择器 ${componentCls}-suffix
依赖版本升级
package.json
升级依赖:@ant-design/cssinjs ^2.0.0 -> ^2.0.1,@ant-design/cssinjs-utils ^2.0.1 -> ^2.0.2

Sequence Diagram(s)

(本次变更为配置/样式与依赖版本调整,未引入新的控制流或运行时交互,故不提供序列图。)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 分钟

  • 变更类型以配置值和样式选择器调整为主,分散在少数文件中,审查复杂度较低。
  • 需额外关注点:
    • 确认将 defaultConfig.hashed 设为 true 是否与全局 CSS-in-JS 运行时预期一致(可能影响样式命名/哈希策略)。
    • 核查移除 GlobalLayout 中显式 hashed 是否会改变最终配置合并顺序或覆盖逻辑。
    • 验证 Mentions 后缀样式在所有使用场景中仍被正确应用(动态类名解析是否一致)。
    • 依赖升级可能带来的细微行为变化,建议执行相关样式/单元测试。

诗歌

一只兔子嗅着变更香,
换了哈希,轻抚样式行。
类名跟随风儿舞,依赖小步长,
代码林间春意长 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR标题清楚地总结了主要变更:将cssinjs的hashed属性默认值改为true,与changeset内容完全对应。
Description check ✅ Passed PR描述虽然采用模板格式,但提供了清晰的变更日志说明修复了ConfigProvider默认未配置theme.hashed为true导致多版本样式冲突的问题。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hashed

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ab9b07 and 9f40076.

📒 Files selected for processing (3)
  • .dumi/theme/layouts/GlobalLayout.tsx (0 hunks)
  • components/mentions/style/index.ts (1 hunks)
  • package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • .dumi/theme/layouts/GlobalLayout.tsx
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always use TypeScript with strict type checking
Never use any type - define precise types instead
Use interfaces (not type aliases) for object structures
Export all public interface types
Prefer union types over enums, use as const for constants
Use early returns to improve readability
Support tree shaking
Follow import order: React → dependencies → antd components → custom components → types → styles
Prefer antd built-in components over external dependencies
Pass all ESLint and TypeScript checks
No console errors or warnings

**/*.{ts,tsx}: Use camelCase for property names
All components and functions must provide accurate type definitions
Avoid using any type, define types as precisely as possible
Use interface rather than type alias for defining object structures
All TypeScript should compile without errors or warnings
Use generics appropriately to enhance type flexibility
Use intersection types (&) to merge multiple types
Use literal union types to define limited option sets
Avoid using enum, prefer union types and as const
Rely on TypeScript's type inference as much as possible
Use type assertions (as) only when necessary
Complex data structures should be split into multiple interface definitions
Avoid outdated APIs and keep updated to new recommended usage

Files:

  • components/mentions/style/index.ts
components/**/style/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

components/**/style/*.ts: Use @ant-design/cssinjs for all styling
Generate styles with functions named gen[ComponentName]Style
Use design tokens from the Ant Design token system
Support both light and dark themes
Use CSS logical properties for RTL support (e.g., margin-inline-start instead of margin-left)
Respect prefers-reduced-motion for animations

Files:

  • components/mentions/style/index.ts
components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Never hardcode colors, sizes, or spacing values

components/**/*.{ts,tsx}: Use TypeScript and React for component development
Use functional components and hooks, avoid class components
Use PascalCase for component names
Use complete names rather than abbreviations in component naming
Initialize properties should use default + PropName naming pattern
Panel opening should use open prop instead of visible
Event handlers should follow on + EventName naming pattern
Child component events should follow on + SubComponentName + EventName naming pattern
Components should provide a ref attribute with nativeElement and focus methods
Export all public interface types for user convenience
Component props should use interface definition named ComponentNameProps
Use CSS transitions for simple animations, rc-motion for complex animations
Respect user's prefers-reduced-motion setting for animations
Follow WCAG 2.1 AA level accessibility standards for styling
Achieve 100% test coverage
Use useLocale hook from components/locale/index.tsx to get localization configuration
Use React.memo, useMemo, and useCallback appropriately for performance optimization
Use React.ForwardRefRenderFunction for component ref types
Callback function types should have explicit parameter and return value definitions
Component state should have dedicated interfaces (e.g., ComponentNameState)
Components should display well on different screen sizes (responsive design)
Components should support right-to-left (RTL) reading direction
Support page zoom to 200% with normal layout
Avoid animations that cause flickering
Ensure code runs normally with no console errors
Avoid unnecessary re-renders
Support Tree Shaking for bundle optimization

Files:

  • components/mentions/style/index.ts
**/*.{ts,tsx,md}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use 2-space indentation

Files:

  • components/mentions/style/index.ts
**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Maintain cross-browser compatibility

Files:

  • components/mentions/style/index.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js}: Use early returns to improve code readability
Pass all ESLint and TypeScript checks

Files:

  • components/mentions/style/index.ts
components/**/style/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Component Token naming format should follow: variant (optional) + semantic part + semantic part variant (optional) + css property + size/disabled (optional)

Files:

  • components/mentions/style/index.ts
components/**/style/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

components/**/style/**/*.{ts,tsx}: Use @ant-design/cssinjs as the styling solution
Style generation functions should follow gen[ComponentName]Style naming convention
Use CSS-in-JS with performance considerations, avoid unnecessary style recalculation
Use class selectors instead of tag selectors for style overrides to improve specificity
Use CSS logical properties (margin-inline-start) instead of directional properties (margin-left) for RTL support
Ensure sufficient color contrast and do not rely on color alone to convey information
Components should use global Tokens and component-level Tokens for styling
Avoid hardcoding colors, sizes, spacing values; use design Tokens instead
Component-level Token naming should follow: Component + property name (e.g., buttonPrimaryColor)
Token modifications should cascade downward to ensure design system consistency
All components must support dark mode
Provide clear visual indication for focus state

Files:

  • components/mentions/style/index.ts
🧠 Learnings (18)
📓 Common learnings
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Use `ant-design/cssinjs` as the styling solution
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to components/**/style/*.ts : Use `ant-design/cssinjs` for all styling
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to components/**/style/*.ts : Use design tokens from the Ant Design token system
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Use class selectors instead of tag selectors for style overrides to improve specificity
Learnt from: Wxh16144
Repo: ant-design/ant-design PR: 55810
File: .dumi/theme/common/VersionUpgrade/ChangeLog.tsx:69-71
Timestamp: 2025-11-24T10:42:01.303Z
Learning: In Ant Design's `.dumi/theme/` documentation and theme files, browser compatibility considerations are less strict than in the component library itself. Native APIs like ResizeObserver can be used directly without requiring polyfills or wrapper packages that are used in the main components.
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Use class selectors instead of tag selectors for style overrides to improve specificity

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Token modifications should cascade downward to ensure design system consistency

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/*.{ts,tsx} : Component Token naming format should follow: `variant (optional)` + `semantic part` + `semantic part variant (optional)` + `css property` + `size/disabled (optional)`

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Components should use global Tokens and component-level Tokens for styling

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/*.{ts,tsx} : Use complete names rather than abbreviations in component naming

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Component-level Token naming should follow: Component + property name (e.g., buttonPrimaryColor)

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Avoid hardcoding colors, sizes, spacing values; use design Tokens instead

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Style generation functions should follow `gen[ComponentName]Style` naming convention

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Use CSS-in-JS with performance considerations, avoid unnecessary style recalculation

Applied to files:

  • components/mentions/style/index.ts
  • package.json
📚 Learning: 2025-11-24T16:30:28.374Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to components/**/style/*.ts : Use CSS logical properties for RTL support (e.g., `margin-inline-start` instead of `margin-left`)

Applied to files:

  • components/mentions/style/index.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Use `ant-design/cssinjs` as the styling solution

Applied to files:

  • package.json
📚 Learning: 2025-11-24T16:30:28.374Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to components/**/style/*.ts : Use `ant-design/cssinjs` for all styling

Applied to files:

  • package.json
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/demo/*.tsx : Demo code import order: React → dependencies → antd components → custom components → types → styles

Applied to files:

  • package.json
📚 Learning: 2025-11-24T16:30:28.374Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to **/*.{ts,tsx} : Prefer antd built-in components over external dependencies

Applied to files:

  • package.json
📚 Learning: 2025-11-24T16:30:28.374Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to **/*.{ts,tsx} : Follow import order: React → dependencies → antd components → custom components → types → styles

Applied to files:

  • package.json
📚 Learning: 2025-11-24T16:30:28.374Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to components/**/style/*.ts : Use design tokens from the Ant Design token system

Applied to files:

  • package.json
📚 Learning: 2025-11-13T02:52:08.942Z
Learnt from: meet-student
Repo: ant-design/ant-design PR: 55697
File: components/drawer/index.tsx:86-88
Timestamp: 2025-11-13T02:52:08.942Z
Learning: In Ant Design components (components/**/*.{ts,tsx}), always use `import useId from 'rc-util/lib/hooks/useId'` instead of `React.useId()` for generating unique IDs, to ensure compatibility with React 16-19. The rc-util hook automatically uses the native implementation in React 18+ and provides a fallback for older versions.

Applied to files:

  • package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
  • GitHub Check: test lib/es module (es, 1/2)
  • GitHub Check: test lib/es module (es, 2/2)
  • GitHub Check: build
  • GitHub Check: test-react-latest (dom, 2/2)
  • GitHub Check: test-node
  • GitHub Check: test-react-latest (dom, 1/2)
  • GitHub Check: test-react-legacy (18, 2/2)
  • GitHub Check: test-react-legacy (18, 1/2)
  • GitHub Check: lint
  • GitHub Check: visual-diff snapshot (1/2)
  • GitHub Check: visual-diff snapshot (2/2)
  • GitHub Check: build preview
  • GitHub Check: build
  • GitHub Check: size
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Cloudflare Pages: ant-design-next
  • GitHub Check: build
🔇 Additional comments (2)
components/mentions/style/index.ts (1)

243-281: Mentions 后缀选择器改为 ${componentCls}-suffix 的调整是合理的

这里改成基于 componentCls 的完整类名选择器,和文件中其他使用 componentCls 组合选择器的写法保持一致,有利于在自定义 prefixCls 与开启 cssinjs hashed 时避免样式错绑或冲突;同时仍然复用设计 Token(颜色、字号、间距)与逻辑属性 insetInlineEnd,符合现有样式与 RTL 规范,没有看到兼容性或回归风险。

Based on learnings, ...

package.json (1)

113-114: cssinjs 相关依赖小版本升级与 PR 目标一致

@ant-design/cssinjs@ant-design/cssinjs-utils 升级到新的补丁版本,和本次将 theme.hashed 默认开启的改动方向一致;本身属于向前兼容的小版本更新,看起来没有明显风险。不过考虑到之前「visual diff 挂了」以及多版本混用样式是本次修复的核心场景,建议在本地或 CI 中重点跑一遍视觉回归(test:visual-regression)以及多版本混用的手动验证,确保升级后没有新的样式覆盖或哈希冲突问题。


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to change the default value of the hashed theme property to true, aligning it with the documentation. While this is a good correction, the current implementation might cause issues with snapshot tests, as a comment in the code indicates that hashing should be disabled in test environments for stability. I've suggested an improvement to make this behavior conditional on the environment, ensuring that hashing is enabled by default for users while preserving the stability of the test suite.

token: defaultSeedToken,
override: { override: defaultSeedToken },
hashed: false,
hashed: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This change aligns the default value of hashed with the documentation, which is great. However, it seems to overlook the comment on line 10 regarding snapshot stability in test environments: // To ensure snapshot stable. We disable hashed in test env..

Changing the default to true unconditionally will likely cause many snapshot tests to fail due to hashed class names.

To address this, I suggest making the value conditional on the environment. This will enable hashing by default for development and production, while keeping it disabled during tests to maintain snapshot stability.

Suggested change
hashed: true,
hashed: process.env.NODE_ENV !== 'test',

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 25, 2025

Deploying ant-design-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9f40076
Status: ✅  Deploy successful!
Preview URL: https://63ebf18c.ant-design-next.pages.dev
Branch Preview URL: https://hashed.ant-design-next.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 25, 2025

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9f40076
Status: ✅  Deploy successful!
Preview URL: https://f5272acd.ant-design.pages.dev
Branch Preview URL: https://hashed.ant-design.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

size-limit report 📦

Path Size
dist/antd.min.js 527.44 KB (+3 B 🔺)
dist/antd-with-locales.min.js 620.56 KB (+3 B 🔺)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 25, 2025

@afc163 afc163 changed the title chore: default hashed fix: cssinjs should be hashed defaultly Nov 25, 2025
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8169124) to head (9f40076).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #55880   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          803       803           
  Lines        14812     14812           
  Branches      3913      3913           
=========================================
  Hits         14812     14812           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

export const defaultConfig = {
token: defaultSeedToken,
override: { override: defaultSeedToken },
hashed: false,
Copy link
Member

Choose a reason for hiding this comment

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

当初为啥要改成 false?

Copy link
Member Author

Choose a reason for hiding this comment

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

css car 后 token 挂载在 css var id 上,但是实际上现在看是不等价的

@afc163
Copy link
Member

afc163 commented Nov 25, 2025

visual diff 挂了

@codecov
Copy link

codecov bot commented Nov 25, 2025

Bundle Report

Changes will decrease total bundle size by 24.53kB (-0.63%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.89MB -24.53kB (-0.63%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.min.js -12.26kB 2.14MB -0.57%
antd.min.js -12.27kB 1.75MB -0.7%

Files in antd-with-locales.min.js:

  • ./components/theme/context.ts → Total Size: 486 bytes

  • ./components/mentions/style/index.ts → Total Size: 8.16kB

Files in antd.min.js:

  • ./components/theme/context.ts → Total Size: 486 bytes

  • ./components/mentions/style/index.ts → Total Size: 8.16kB

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 25, 2025
@zombieJ zombieJ merged commit a26733f into master Nov 25, 2025
45 checks passed
@zombieJ zombieJ deleted the hashed branch November 25, 2025 07:54
@PeachScript PeachScript mentioned this pull request Dec 2, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants