Skip to content

Clarify the cause of "asynchronously handled actions" dispatched from a function that has effectively awaited. #6818

Open

Description

@techanvil

Feature Description

The previous issue #6784 dealt with the scenario where multiple Redux actions dispatched in a function that has awaited, or from a generator function that has been re-entered after an await, resulted in multiple React renders, whereas the same actions dispatched in a regular function (specifically, in a click handler) resulted in a single update.

It wasn't immediately clear what the reason was, but it was subsequently noticed that the likely cause is React's own state update batching functionality. For more in this, see this article.

We should verify this is indeed the cause, and update the related inline comment for accuracy.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The cause of the "asynchronously handled actions" described above should be confirmed, and the referenced inline comment should be updated to reflect this understanding.

Implementation Brief

  • In assets/js/modules/analytics-4/datastore/properties.js:
    • Update the comment above the final setSettings() call in *updateSettingsForMeasurementID() to explain:
      • React 17 batches updates within React event handlers, but does not automatically batch updates after an asynchronous continuation.
      • Plain actions still update the store synchronously; separate dispatches after an await, including a generator resumed after an asynchronous control, can cause separate renders.
      • Setting googleTagAccountID, googleTagContainerID, and googleTagID in one action prevents GoogleTagIDMismatchNotification from rendering with mismatched settings and requesting incorrect container destinations.
      • Retain the existing references documenting the original fix. Describe the earlier setSettings() call as keeping related settings together without implying that its branch has already awaited.

Test Coverage

  • Not needed. Docs-only change.

QA Brief

Changelog entry

Activity

  1. added
    P2
    Type: Enhancement
    on Apr 5, 2023
  2. added
    Team M
    on Mar 17, 2025
  3. self-assigned this
    on Apr 6, 2026
  4. removed their assignment
    on Aug 12, 2026
  5. added
    Next Up
    on Sep 8, 2026
  6. removed
    Next Up
    on Sep 29, 2026
  7. self-assigned this
    on Oct 1, 2026
  8. JakePT commented on Oct 5, 2026

    @JakePT
    Collaborator

    Small inline-documentation-only change so I opened a PR alongside adding the IB.

  9. removed their assignment
    on Oct 5, 2026
  10. self-assigned this
    on Oct 30, 2026
  11. techanvil commented on Oct 30, 2026

    @techanvil
    CollaboratorAuthor

    IB ✅

  12. removed their assignment
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Team MType: Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions