Open
Description
- From: Last call for
@nextcloud/vue v9
breaking changes #6384 - Reported by: @ShGKme
Proposal: decompose "super" components.
A super-component is a large component that tries to do too much work for different, sometimes very narrow, cases.
Why
Such components often have tens of props, complex implementation and 1000-2000+ lines of code, while 200-400 is a limit for a good component.
Examples
NcActions
, covers:- Simple menus, including navigation and
inline
feature - Custom menus with custom button contents
- Dialogs with forms
- Simple menus, including navigation and
NcAvatar
- Minimal: just an image
- Maximum: user metadata fetching + user status + contacts menu
NcAppSidebar
- On one hand - a universal sidebar
- On another - contents Files-specific app features such as "favorite"
- Same with
NcModal
with viewer-only features
NcSelect
- Universal component, but has
UserSelect
as built-in feature - ✅ was already decomposed in v9 with feat!: split
NcSelect
super component intoNcSelect
andNcSelectUsers
#6732
- Universal component, but has
What to do
- Decompose to base components and more specific components
- e.g.
NcSelect
=>NcSelect
+NcSelectUsers
- e.g.
- Make a base component extendable and customize in place where needed
- e.g.
NcAppSidebar
for Files app use cases
- e.g.