nextcloud-libraries / nextcloud-libraries/nextcloud-vue
[RFC] Proposal: Decompose super-components
Nobody has claimed this yet.
- Dominant language
- Vue
- Stars
- 246
- Forks
- 99
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 103
Description
- From: https://github.com/nextcloud-libraries/nextcloud-vue/issues/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
inlinefeature - 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
NcModalwith viewer-only features
-
NcSelect- Universal component, but has
UserSelectas built-in feature - ✅ was already decomposed in v9 with https://github.com/nextcloud-libraries/nextcloud-vue/pull/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.
NcAppSidebarfor Files app use cases
- e.g.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the listed super-components: NcActions, NcAvatar, and NcAppSidebar, along with the completed NcSelect decomposition and linked pull request. Determine which component should be addressed first, identify its distinct use cases, and define base and specialized components whose responsibilities are separated without losing existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100