nextcloud-libraries / nextcloud-libraries/nextcloud-vue

Reorganize reference widget API to improve tree-shaking

Open
#8,081 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vue
Stars
246
Forks
99
Avg merge
1d 20h
Merged PRs (30d)
103

Description

Currently we export:

  • @nextcloud/vue/functions/reference:
    • hasInteractiveView
    • isWidgetRegistered 🔴
    • registerWidget 🟢
    • renderWidget 🔵
    • ⚠️ getLinkWithPicker 🟣
    • anyLinkProviderId 🟤
    • getProvider 🟡
    • getProviders 🟠
    • searchProvider 🟥
    • sortProviders 🟧
    • isCustomPickerElementRegistered 🟩
    • ⚠️ NcCustomPickerRenderResult 🟦
    • registerCustomPickerElement 🟪
    • renderCustomPickerElement 🟫
  • @nextcloud/vue/functions/registerReference:
    • destroyWidget
    • isWidgetRegistered 🔴
    • registerWidget🟢
    • renderWidget 🔵
  • @nextcloud/vue/components/NcRichText:
    • anyLinkProviderId 🟤
    • ⚠️ getLinkWithPicker 🟣
    • getProvider 🟡
    • getProviders 🟠
    • isCustomPickerElementRegistered 🟩
    • isWidgetRegistered 🔴
    • ⚠️ NcCustomPickerRenderResult 🟦
    • ⚠️ NcReferenceList
    • ⚠️ NcReferencePicker
    • ⚠️ NcReferencePickerModal
    • ⚠️ NcReferenceWidget
    • ⚠️ NcSearch
    • registerCustomPickerElement 🟪
    • registerWidget🟢
    • renderCustomPickerElement 🟫
    • renderWidget 🔵
    • searchProvider 🟥
    • sortProviders 🟧

⚠️ = Side Effect. It means, importing anything from this export also imports the part with a side effect

Coloured circles and squares = duplicates.

Due to side effects, even importing a small getProvider function is 200kb.

Proposal

  1. Make sure all the exports are really needed. And if not -- remove
  2. Deprecate unneeded duplicates
  3. Reorganise existing functions to have side effect free exports

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the exports from @nextcloud/vue/functions/reference, @nextcloud/vue/functions/registerReference, and @nextcloud/vue/components/NcRichText, then identify which duplicates and side-effect imports are actually needed. The work is done when unnecessary exports are removed or deprecated and the remaining functions can be imported without pulling in unrelated side effects.

Written by the indexing model from the issue text.

Assessment

Domain
frontend, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.