跪拜 Guibai
← All articles
Frontend

A Forced Component Library Upgrade Broke Layouts, Crashed Pages, and Triggered a Three-Day Scolding Spree

By 涛涛ing ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Internal component libraries become de facto platform contracts; a single breaking release can force hundreds of file changes across every team that depends on them. This case shows why separation of UI primitives from business logic isn't a style preference but a practical way to keep a shared library from becoming the bottleneck of every release cycle.

Summary

An internal Vue component library, maintained for over two years and pushed as a mandatory v3.0 upgrade, caused immediate chaos across business lines. The Select component's default height change from 32px to 36px shifted dozens of page layouts; Table made row-key a required prop and threw errors that blanked screens; DatePicker stopped fallback-parsing formats and started throwing exceptions in production.

The root problem wasn't technical. The library had grown into a jumble of business logic: a single Table component carried 40+ props and hundreds of if-else branches to accommodate different business scenarios. The infrastructure team's "elegant" refactor—renaming value to modelValue, splitting options into data and dict, and adding global box-sizing—ignored the real cost of breaking every consumer's codebase.

After three days of backlash, the team split the 3,000-line Table into a useTable logic hook and a TableShell render layer, forcing business lines to write their own export, delete, and permission logic. They removed all default values from components, making explicit props mandatory, and built a legacyAdapter compatibility layer so v2 calls silently translate to v3, giving teams six months to migrate.

Takeaways
— The team maintained over 80 components with more than 3,000 lines of compatibility logic in the library's source.
— The v3.0 change of Select's default height from 32px to 36px broke layout alignment across many pages.
— Table's row-key became a required prop in v3.0, causing immediate runtime errors and white screens.
— DatePicker previously accepted any format with fallback handling, but v3.0 switched to throwing exceptions on invalid formats.
— Business logic embedded in base components—export, batch delete, permissions—bloated Table to 40+ props and many if-else branches.
— The remediation split Table into useTable (logic hook) and TableShell (rendering only), pushing business-specific features back to consumers.
— All clever default values were removed; components now require explicit props from the business side.
— A legacyAdapter compatibility layer auto-translates v2 call patterns to v3, allowing gradual migration over six months.
— The author advises teams under 50 people to skip building a complex component library and use Element Plus / Ant Design with a theme wrapper instead.
Conclusions

A component library built as a 'Swiss Army knife' quickly becomes a dependency hell the moment versions diverge; style conflicts between v2 and v3 on the same page mirror classic Dubbo-style version mismatch issues.

The real cost of a breaking change is not the code edit but the forced rescheduling of every business line's release plan, which infrastructure teams usually underestimate.

Default values are a hidden contract: what looks like convenience to the library author is read as overstepping authority by the consuming team.

Headless UI (logic hooks separated from rendering) naturally redraws the boundary between shared infrastructure and business-specific behavior, which is a more durable boundary than a monolithic component.

Concepts & terms
Headless UI
A pattern where UI components expose their logic and state through hooks or render props, while leaving the visual rendering and business-specific features to the consumer. In this article, the Table component was split into useTable (logic) and TableShell (rendering) so business lines can assemble their own features.
Breaking change
A version update that requires consumers to modify their code to keep the library working, such as renaming props, splitting components, or changing default behavior. The article labels it a 'destructive update' and details how it forced hundreds of file changes across business teams.
legacyAdapter
A compatibility layer that intercepts old API usage and translates it to the new version's logic, allowing existing code to keep working without modification while a migration warning is shown. The team used this to soften the impact of v3.0.
From the discussion
Featured comments
云沙 1 likes

With all due respect, your infrastructure team simply doesn't have the ability to write a good shared component. The Table component mixes in a large amount of business-coupled logic, and even after the rewrite, they want to stuff input boxes and modals into Table. What do Table and these things have to do with each other? This seriously violates the Single Responsibility Principle. What project teams need are individual building blocks, not a toy assembled from building blocks.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗