Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Work in progress Orphaned

67432[BUGFIX] Make BroadcastMessage.fromData() idempotent

Benjamin Franzke CR -2 V 0 Normal +43 −31 updated 11/29/21, 18:21

Commit message

BroadcastMessage.fromData() used to nest the entire data (which
includes a payload property itself) into another wrapping payload
property.
That caused a BroadcastMessage with a payload of {foo: "bar"}
to to end up with {payload: {foo: "bar"}} as payload, when
recreated using BroadcastMessage.fromData().

BroadcastMessage.fromData() is now fixed to preserve the correct
data structure and BroadcastMessage.createCustomEvent() is adapted
to retain the previous – additional – payload subproperty in order
to preserve backwards compatibility.

Also AjaxDataHandler is adapted to create local events with
BroadcastMessage.createCustomEvent(). This is possible, now that
local and remote BroadcastMessages are compatible.

SlugService is adapted to use the correct BroadcastMessage structure
and the changelog documentation is also fixed to refer to the correct
BroadcastMessage. The API has been explicitly marked as internal
and as possibly changing at any time, therefore it's not considered
breaking to fix this as a documentation bug.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 9
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/32/67432/9 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/32/67432/9 && git cherry-pick FETCH_HEAD

Review

  • Code review CR -2 Blocked
    • Benjamin Franzke -2
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Issues 2

Files 8

Review log 2434

Show 69 earlier messages
  1. Benjamin Franzke uploaded patch set 1 01/12/21, 11:10

  2. TYPO3com voted on patch set 1 V +1 01/12/21, 11:19 Completed build in 09m 04s on Tue, 12 Jan, 11:19 AM Test Summary: 32575 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8820

  3. Oliver Hader uploaded patch set 2 01/12/21, 14:20

  4. Oliver Hader commented on patch set 2 CR -1 01/12/21, 14:24

    I've adjusted JavaScript being created in SlugService... However, the new handling in `BroadcastMessage.fromData` is not compatible anymore with https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.1/Feature-89244-BroadcastChannels.html * `BroadcastService.post(payload);` * triggers `BroadcastService.onMessage()` * calls `BroadcastMessage.fromData()` * `payload` property is missing here I agree the changes in this patch are much better - however the previous `delete componentName;` etc. should be kept as a fall-back in case `data.payload` is not given - otherwise this would be a breaking change.
  5. TYPO3com voted on patch set 2 V +1 01/12/21, 14:30 Completed build in 09m 04s on Tue, 12 Jan, 02:30 PM Test Summary: 32575 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8832

  6. Benjamin Franzke commented on patch set 2 01/12/21, 14:57

    Reply

    Yes, thank you. As aggreed on Slack, I will adapt the Changelog documentation, but as the API is internal and the documentation incompatible to the BroadcastMessage interface, we'll strive for clean code, rather than bc quicks.
  7. Benjamin Franzke uploaded patch set 3 01/14/21, 05:36

  8. Benjamin Franzke commented on patch set 3 01/14/21, 05:36

    Reply

    Done
  9. TYPO3com voted on patch set 3 V -1 01/14/21, 15:32 Completed build in 09m 56s on Thu, 14 Jan, 03:32 PM Test Summary: 1 of 32816 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8854

  1. Oliver Hader rebased onto patch set 4 01/15/21, 13:04

  2. TYPO3com voted on patch set 4 V +1 01/15/21, 13:20 Completed build in 14m 51s on Fri, 15 Jan, 01:19 PM Test Summary: 32575 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8865

  3. Oliver Hader voted on patch set 4 CR +1 01/17/21, 12:48

  4. Benjamin Franzke uploaded patch set 5 03/10/21, 21:44

    Resolve Merge Conflict
  5. TYPO3com voted on patch set 5 V +1 03/10/21, 21:55 Completed build in 10m 53s on Wed, 10 Mar, 09:55 PM Test Summary: 32680 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10033

  6. core-ci voted on patch set 5 V +1 03/10/21, 21:55 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1394

  7. Benjamin Franzke uploaded patch set 6 08/31/21, 08:18

    Resolve Merge Conflict
  8. Oliver Hader voted on patch set 6 CR +1 08/31/21, 08:21

  9. core-ci voted on patch set 6 V +1 08/31/21, 08:31 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15912

  10. Markus Klein updated the commit message in patch set 7 09/17/21, 06:18

  11. core-ci voted on patch set 7 V +1 09/17/21, 06:35 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16850

  12. Benni Mack commented on patch set 7 09/28/21, 15:07

    In general, I think this patch is good, however I would probably only do this in master only
  13. Benjamin Franzke updated the commit message in patch set 8 09/28/21, 16:21

  14. Benjamin Franzke commented on patch set 8 09/28/21, 16:21

    Reply

    Ack
  15. core-ci voted on patch set 8 V +1 09/28/21, 16:35 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17276

  16. Oliver Hader voted on patch set 8 CR +1 09/28/21, 16:42

  17. Christian Kuhn commented on patch set 8 CR -1 09/29/21, 09:05

    Feature-89244-BroadcastChannels.rst:44

    it's a bit tricky to change v10 .rst files in v11 and only in v11: in general, the .rst files should be identical between versions (and i actively sync them sometimes to avoid discrepancies). a patch that changes a v10 .rst for v11 only, is thus unfortunate. is there any way around that, eg. either a new .rst file for the changed API for v11 only, or have the patch in v10, too?
  18. Benjamin Franzke commented on patch set 8 09/29/21, 12:12

    Feature-89244-BroadcastChannels.rst:44 Reply Unresolved

    Well, please see https://review.typo3.org/c/Packages/TYPO3.CMS/+/67432/8#message-c7944f395ca355ae14a12ef14bff9d5250da5797 It was initially planned for v10 too, but Benni opted for master-only. And then there is this sentence in the header of the .rst: This API is considered internal and may change anytime until declared being stable. @Benni: Maybe v10 become fine again considering that disclaimer? (actually that was the reason why we thought it's fine to backport this fix to v10)
  19. Benni Mack commented on patch set 8 10/07/21, 08:29

    please rebase. Anyway, my gut feeling tells me that this _might_ become a bit more tricky, however I can't proof this. If you all agree with v10, let's do this.
  20. Benjamin Franzke commented on patch set 8 CR -1 10/07/21, 12:44

    BroadcastMessage.ts:44 Unresolved

    CR-1 for now, this is potentially breaking.
  21. Benjamin Franzke commented on patch set 8 CR -2 10/07/21, 13:19

    Reply Unresolved

    Thanks Benni, you are right, think could be breaking for extensions. There is indeed a conflict between the broadcast messages send for the AjaxDataHandler (which my patch was aligning for) and for those that used the API. The difference is in the event handler that contains `detail: { payload: { a, b } }` for AjaxDataHandler events while all other broadcasts use `payload: { a, b }`. That means how ever we fix this will be breaking to one or the other. I think I'll rather see how to reduce usage of this service as I think plain events are sufficent in most cases where we use broadcasts. Therefore I'll mark this WIP now.
  22. Benjamin Franzke marked it work in progress 10/07/21, 13:19

  23. Benni Mack wrote 11/29/21, 10:12

    Change destination moved from master to main
  24. Benni Mack updated the commit message in patch set 9 11/29/21, 14:03

  25. core-ci voted on patch set 9 V +1 11/29/21, 18:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20084