87999[TASK] Consolidate page tree refresh
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 18
- Build/Sources/TypeScript/backend/element/editable-page-title.ts+2 −1
- Build/Sources/TypeScript/backend/viewport/navigation-container.ts+4 −0
- Build/Sources/TypeScript/backend/wizard/move-page.ts+2 −1
- Build/Sources/TypeScript/backend/ajax-data-handler.ts+3 −9
- Build/Sources/TypeScript/backend/context-menu-actions.ts+1 −5
- Build/Sources/TypeScript/backend/recordlist.ts+2 −1
- Build/Sources/TypeScript/recycler/recycler.ts+2 −8
- Build/Sources/TypeScript/workspaces/toolbar/workspaces-menu.ts+1 −8
- Build/Sources/TypeScript/workspaces/backend.ts+7 −13
- typo3/sysext/backend/Resources/Public/JavaScript/element/editable-page-title.js+2 −2
- typo3/sysext/backend/Resources/Public/JavaScript/viewport/navigation-container.js+1 −1
- typo3/sysext/backend/Resources/Public/JavaScript/wizard/move-page.js+1 −1
- typo3/sysext/backend/Resources/Public/JavaScript/ajax-data-handler.js+1 −1
- typo3/sysext/backend/Resources/Public/JavaScript/context-menu-actions.js+1 −1
- typo3/sysext/backend/Resources/Public/JavaScript/recordlist.js+1 −1
- typo3/sysext/recycler/Resources/Public/JavaScript/recycler.js+1 −1
- typo3/sysext/workspaces/Resources/Public/JavaScript/toolbar/workspaces-menu.js+1 −1
- typo3/sysext/workspaces/Resources/Public/JavaScript/backend.js+2 −2
Review log 89
-
Andreas Kienast uploaded patch set 1 02/03/25, 15:35
-
Andreas Kienast uploaded patch set 2 02/03/25, 15:36
-
Andreas Kienast uploaded patch set 3 02/03/25, 15:36
-
core-ci voted on patch set 3 V +1 02/03/25, 15:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73419
-
Ayke Halder commented on patch set 3 CR -1 02/04/25, 15:37
On the general idea: Is the `@typo3/backend/viewport/navigation-container` the right place to implement the event-trigger-action `refreshNavigation()`? By doing this, each place which only needs to *use* the event-trigger-action, must thereby 'import' the complete `navigation-container` + relations (= download the JS-file). IMO this code here is already a very abstract event-trigger: `top.document.dispatchEvent(new CustomEvent('typo3:pagetree:refresh'))` ---- TYPO3 further abstracted the event-trigger concept with: 61788: [FEATURE] Introduce Broadcast Messaging | https://review.typo3.org/c/Packages/TYPO3.CMS/+/61788 Also see: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.1/Feature-89244-BroadcastChannels.html https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Backend/BroadcastChannels.html Unfortunately, the Broadcast Messaging - as implemented right now - can only be used for messages coming *from one specific sender* and being *received by multiple receivers*. `BroadcastMessage::createCustomEvent`: ```js public createCustomEvent(scope: string = 'typo3'): CustomEvent { return new CustomEvent( [scope, this.componentName, this.eventName].join(':'), { detail: this.payload }, ); } ``` Resulting in events like e.g. * `typo3:typo3-backend-editable-page-title:refresh-navigation` * `typo3:typo3-backend-wizard-move-page:refresh-navigation` * `typo3:typo3-backend-ajax-data-handler:refresh-navigation` * `typo3:typo3-backend-context-menu-action:refresh-navigation` * `typo3:typo3-backend-recordlist:refresh-navigation` * `typo3:typo3-recycler:refresh-navigation` * `typo3:typo3-workspaces-menu:refresh-navigation` * `typo3:typo3-workspaces-backend:refresh-navigation` * etc. … which can not be easily tracked by one event receiver. ---- To get a clean solution here, how about extending the Broadcast Messaging to trigger an additional generic event for each action. This generic event provides *events from multiple senders* that are *received by one receiver*: E.g. `BroadcastMessage::createGenericCustomEvent`: ```js public createGenericCustomEvent(scope: string = 'typo3'): CustomEvent { return new CustomEvent( [scope, 'GENERIC', this.eventName].join(':'), { namespace: this.componentName, detail: this.payload, }, ); } ``` Thereby the receiver component can listen to a single event: * `typo3:GENERIC:refresh-navigation` If necessary the event-handling function could still check `namespace` to see which component originally triggered the event. -
Andreas Kienast commented on patch set 3 02/04/25, 15:45
Reply
`top.document.dispatchEvent(new CustomEvent('typo3:pagetree:refresh')` is indeed very abstract. Too abstract and hard to remember, in my opinion. Since this code is spread all over our modules, consolidating this into a dedicated method makes sense. Downloading the JS file(s) is a non-issue since they are loaded anyway when opening the backend. -
Ayke Halder commented on patch set 3 02/04/25, 15:56
Reply
If not downloading, then extra running them is a small performance penalty - minor issue. Still I think this is a good use-case to introduce the option for event-listener like this: ```js document.addEventListener( 'typo3:pagetree:refresh-navigation', this.runOnEventRefreshNavigationFromComponentPagetree ); document.addEventListener( 'typo3:pagetree:*', this.runOnAnyEventFromComponentPagetree ); document.addEventListener( 'typo3:*:refresh-navigation', this.runOnEventRefreshNavigationFromAnyComponent ); ``` -
Andreas Kienast commented on patch set 3 02/05/25, 06:23
Reply Unresolved
This is not what the patch aims for. Besides, I don't understand how your proposal _splifies_ things. -
Andreas Kienast abandoned the change 02/05/25, 07:12
The general behavior is different to the file tree. This needs more conceptual work.