•  
      request #41467 Refactor artidoc's composable architecture
    Infos
    #41467
    Thomas Gorka (tgorka)
    2025-01-17 16:00
    2025-01-17 16:00
    43149
    Details
    Refactor artidoc's composable architecture

    In artidoc, features are split in different "composables" objects and stores.

    The problem with this architecture is that:

    - The composables are becoming god objects (does not comply with SRP)

    - The composables are sometimes heavily dependant of another composables or stores.

    - Some composables are basically proxies for another composable (feature envy code smell)

    - All the layers of the app are merged into them. They handles actions, execute API calls, transform payloads, store information, update the UI (loading/saving/refresh/error states) etc.

    Initially, the composables were introduced to avoid passing properties to the components. Paradoxically, it is the contrary that happens, because the components actually are receiving a ton of properties (often extracted from said composables).

    The current architecture makes it hard to keep on developing new features, such as the nesting of sections.

    The proposition is the following:

    1. Make the SectionsStore a SectionCollection and inject it into the application.

    2. Extract all the actions implemented in the SectionStore into dedicated class-like objects.

    3. Split the composables step by step into different class-like objects?

     

    Artidoc
    development
    Empty
    • [ ] enhancement
    • [x] internal improvement
    Empty
    Stage
    Thomas Gorka (tgorka)
    Under implementation
    Empty
    Attachments
    Empty
    References
    Referencing request #41467

    Git commit

    tuleap/tuleap/stable

    refactor: extract loading from SectionsStore 2d6d56d35f
    refactor: extract insertion of pending sections 7e0fb773f0
    refactor: extract replacement of pending sections 34c209b369
    refactor: extract insertion of sections 0f94ee0cdd
    refactor: extract update of sections ab58d8979b
    refactor: extract removal of sections 9dd84383ce
    refactor: extract retrieval of sections position 08f700fa88
    refactor: have a dedicated src/sections folder b3d3bcf107
    refactor: extract editors states into a global collection d7934962e3
    refactor: merge error states with sections states 3c84723a7c
    refactor: kill useAttachmentFile ed209e96e5
    refactor: kill useEditorSectionContent ee2da635c7
    refactor: Kill useUploadFileStore d1261728bb
    refactor: Kill useRefreshSection 9ef2f8ec97
    refactor: kill useSaveSection and useSectionEditor 8c0eff2332
    refactor: nuke mockStrictInject dd58167e06
    fix: section editor state is wrongly reset 92aabd5158
    fix: Dropped images are not anymore part of artifact attachment field 0e10981a13
    refactor: split the sections/ folder into smaller subfolders 1a282dce01