Clarify the cause of "asynchronously handled actions" dispatched from a function that has effectively awaited.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 383
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 77
Description
## Feature Description
The previous issue https://github.com/google/site-kit-wp/issues/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](https://javascript.plainenglish.io/batch-updates-in-react-17-or-earlier-versions-5f76d58e3af1).
We should verify this is indeed the cause, and update the related [inline comment](https://github.com/google/site-kit-wp/blob/6ea9e6935ab149a576e9ee4c90414e0aa5fc3b4b/assets/js/modules/analytics-4/datastore/properties.js#L500-L505) 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](https://github.com/google/site-kit-wp/blob/6ea9e6935ab149a576e9ee4c90414e0aa5fc3b4b/assets/js/modules/analytics-4/datastore/properties.js#L500-L505) should be updated to reflect this understanding.
## Implementation Brief
*
### Test Coverage
*
## QA Brief
*
## Changelog entry
*
Contributor guide
Research direction
Review the Redux dispatch behavior described in the issue and the linked React batching article, then inspect the inline comment in assets/js/modules/analytics-4/datastore/properties.js around lines 500-505. Confirm whether React state update batching explains the asynchronous renders and update that comment to accurately describe the cause.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, redux
- Domain
- frontend
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100