docs: record native tag guard evidence

This commit is contained in:
tangweijie 2026-06-05 12:47:25 +08:00
parent f2babf5353
commit ad2fa59232

View File

@ -0,0 +1,28 @@
# Frontend Form Create Native Tag Guard Evidence
- Date: 2026-06-05
- Repository: `water-frontend`
- Branch: `develop`
- Scope: production/dev-mode build warning where Element Plus `ElSelect` dropdown renders `ElScrollbar tag="ul"` and Vue resolves it as `<Ul>`.
## Root Cause
Vue `resolveDynamicComponent('ul')` checks the app component registry before falling back to a native tag. A global component alias such as `Ul` can therefore shadow the native `ul` tag. Element Plus `ElScrollbar` uses dynamic tag rendering internally, so a polluted global registry causes its dropdown list to render as a component and emit:
`Extraneous non-props attributes (...) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
## Frontend Change
- Added `src/plugins/formCreate/nativeTagComponentGuard.ts`.
- Invoked the guard after `formCreate` and `FcDesigner` installation in `src/plugins/formCreate/index.ts`.
- The guard removes global component aliases matching native HTML/SVG tags after third-party plugin registration, preventing dynamic native tags such as `ul` from resolving to global Vue components.
## Verification
- `node --test tests/layout/nativeTagComponentGuard.test.mjs`: passed, 2 tests.
- `node --max-old-space-size=8192 ./node_modules/vite/bin/vite.js build --mode dev`: passed, generated `dist`.
- `node --max-old-space-size=8192 ./node_modules/vue-tsc/bin/vue-tsc.js --noEmit`: failed on existing repository-wide type errors outside this change scope, including mall statistics, BPM designer, pay pages, settings pages, and casing mismatch under `settings/waterMeter/range`.
## Notes
- The first `pnpm run` verification attempt triggered pnpm dependency-state auto-install in a non-TTY environment. `node_modules` was restored with `CI=true pnpm install --ignore-scripts`, and verification was continued by invoking local binaries directly.