74224[BUGFIX] Avoid race conditions in pagetree contextmenu actions
Commit message
Review
-
Code review CR +2 Done
- Andreas Kienast +2
- Stefan Bürk +1
-
Verified V +2 Done
- Andreas Kienast +2
- Stefan Bürk +1
- core-ci +1 CI
Issues 2
Files 2
Review log 1215
-
Benjamin Franzke uploaded patch set 1 04/07/22, 19:19
-
Benjamin Franzke updated the commit message in patch set 2 04/07/22, 19:27
-
core-ci voted on patch set 1 V +1 04/07/22, 19:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/25790
-
core-ci voted on patch set 2 V +1 04/07/22, 19:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/25791
-
Stefan Bürk updated the commit message in patch set 3 04/07/22, 21:33
-
core-ci voted on patch set 3 V +1 04/07/22, 21:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/25796
-
Stefan Bürk voted on patch set 3 V +1 CR +1 04/07/22, 21:45
-
Benni Mack commented on patch set 3 04/07/22, 22:43
any reason why we don't do the migration to AjaxDataHandler directly? -
Benjamin Franzke commented on patch set 3 04/08/22, 06:04
Reply
Good point, unfortunately not possible without more refactoring. As the contextmenu is also used in the page- and list-module, we'd also need to refresh the list entries and the page-module frames. I think that change would be too big for v11, as we not have ajax-based UI-updates in the page-module content elements at all (yet). Sure, we could only use AjaxDataHandler in contextmenu-in-pagemodule, but again that would be too much logic for a backport (IMO). -
Andreas Kienast commented on patch set 3 CR -1 04/08/22, 06:50
on it -
Andreas Kienast commented on patch set 3 04/08/22, 06:54
We have the same effect with deleting a page from the page tree. For testing purposes I removed `ContextMenuActions.refreshPageTree()` from the `button.clicked` event and interestingly the page tree is sometimes refreshed and sometimes not. Is this something we can fix here as well or does this require refactorings as well? -
Benjamin Franzke commented on patch set 3 04/08/22, 07:21
Reply
oh, good catch, so this one happens when the deleted page is currently opened. Then the iframe URL is implicitly changed by: top.document.dispatchEvent(new CustomEvent('typo3:pagetree:selectFirstNode')); And the response then contains <typo3-immediate-action action="TYPO3.Backend.Event.EventDispatcher.dispatchCustomEvent" args="[&quot;typo3:pagetree:refresh&quot;,null,true]"></typo3-immediate-action> So from what I read you could only trigger the "sometimes" because we have currently either two refreshes (if the page is active) or one refresh (if the deleted page hasn't been active). But those refreshes actually do not race, as both are executed after the persistence is done. That would be something to optimize to only one refresh – but I'm not sure… We could write: if (ModuleStateStorage.current('web').identifier === uid.toString()) { top.document.dispatchEvent(new CustomEvent('typo3:pagetree:selectFirstNode')); } else { ContextMenuActions.refreshPageTree(); } And rely on the fact that persistence adds a pagetree-refresh-request to the user session signal-code stack, and that it is implicitly retrieved by "next" ready request. So I'm not sure where this might fail if another concurrent request already fetches from the request. Summary: Optimizing this in the current way may introduce new races, therefore I'd leave that as is. Best would be to instruct AjaxDataHandler not to set an update signal as the frontend-side promises to do that on it's own after completion, and yea, I feel like that's too much refactoring for v11. -
Benjamin Franzke commented on patch set 3 04/08/22, 07:22
Reply
> So from what I read you could only trigger the "sometimes" because we have currently either two refreshes (if the page is active) or one refresh So what I mean: You could trigger it because you removed one of the refreshes, but I think it's not triggerable in realworld. -
Andreas Kienast commented on patch set 3 V +2 CR +2 04/08/22, 07:44
Alright, thanks for your explanations! -
Andreas Kienast merged patch set 4 04/08/22, 07:44