Skip to content

fix(design-system): silence OcDrop attr-inheritance warning storm#2560

Merged
JammingBen merged 2 commits into
opencloud-eu:mainfrom
dschmidt:fix/oc-drop-attrs-inheritance
May 20, 2026
Merged

fix(design-system): silence OcDrop attr-inheritance warning storm#2560
JammingBen merged 2 commits into
opencloud-eu:mainfrom
dschmidt:fix/oc-drop-attrs-inheritance

Conversation

@dschmidt
Copy link
Copy Markdown
Contributor

@dschmidt dschmidt commented May 19, 2026

Summary

  • OcDrop's template root is a fragment (mobile drawer OR Transition + Teleport), so Vue's default attr auto-inheritance can't pick a single root and falls through to a console warning: Extraneous non-props attributes (class, options) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.
  • In a typical session the TopBar mounts at least four OcDrop instances (notifications, app switcher, user menu, and most file-action menus). Each one fires the warning every render. In dev the console floods with hundreds of these per page interaction and the tab gets visibly sluggish.
  • Switching to inheritAttrs: false + explicit v-bind="attrs" on the inner drop div silences the warning without changing the rendered HTML for any existing caller — attrs.class was already forwarded manually, and Vue merges the v-bind-supplied class with the static one.

dschmidt added 2 commits May 19, 2026 21:44
OcDrop's root is a fragment (oc-mobile-drop OR Transition+Teleport),
so Vue can't auto-inherit caller-supplied attrs. With the default
`inheritAttrs: true` Vue logged "Extraneous non-props attributes
(class, options) were passed to component but could not be
automatically inherited because component renders fragment or text
or teleport root nodes" once per OcDrop instance per render.

In a typical web session with notifications, app-switcher, account
menu and a couple of file-action dropdowns all sitting in the
TopBar, the warning fires hundreds of times per page render and
makes the dev console (and through it, the whole tab) crawl.

Switch to `inheritAttrs: false` and forward the consumer's attrs
explicitly via `v-bind="attrs"` on the inner drop div. The existing
`:class="attrs?.class"` binding stays so duplicate class handling
remains intact (Vue merges `v-bind`-supplied class with the static
one). All 16 OcDrop specs stay green.
With `inheritAttrs: false` on OcDrop the consumer-supplied `class` no
longer auto-lands on the outer Transition/Teleport fragment root --
it's forwarded explicitly to the inner drop div via `v-bind="attrs"`,
which is teleported and so doesn't appear inside the snapshot tree.
Real DOM still receives the class as before; only the rendered tree
the test serializes lost the attribute.

Updated snapshots:
- ContextActionMenu: 2 occurrences of the file-action drop wrapper
- SpaceHeader: 3 occurrences across the sidebar / image / description
  test cases
@JammingBen JammingBen merged commit b79c275 into opencloud-eu:main May 20, 2026
30 checks passed
@openclouders openclouders mentioned this pull request May 19, 2026
1 task
openclouders pushed a commit that referenced this pull request May 20, 2026
fix(design-system): silence OcDrop attr-inheritance warning storm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants