HomePhabricator
Diffusion Comm a00efd928866

[native] Stop calling saveMessageInfos from androidBackgroundMessageTask

Description

[native] Stop calling saveMessageInfos from androidBackgroundMessageTask

Summary:
androidBackgroundMessageTask runs separately from the main app, and doesn't have any mechanisms in place to wait for redux-persist and SQLite before dispatching Redux actions.

The result of this is that the store can be messed up. See ENG-2275 for details on how this can happen.

This diff removes the saveMessageInfos call from handleAndroidMessage, which gets called in two scenarios. The first scenario is androidBackgroundMessageTask, and in that scenario we don't want to call saveMessageInfos. The second scenario is PushHandler.androidMessageReceived, and in that scenario we'll continue calling saveMessageInfos.

Since the only component we need to call saveMessageInfos from now is PushHandler, I also replaced the hacky dispatch import approach we were taking before in push/utils.js with a more idiomatic approach.

Test Plan: Confirm that issue in ENG-2275 no longer repros

Reviewers: atul, tomek, marcin

Reviewed By: tomek

Subscribers: marcin

Differential Revision: https://phab.comm.dev/D5667

Details

Provenance
ashoatAuthored on Nov 18 2022, 5:12 AM
Reviewer
tomek
Differential Revision
D5667: [native] Stop calling saveMessageInfos from androidBackgroundMessageTask
Parents
rCOMM8fb121d970f4: [web] Refactor - remove instances of useMemo + classNames combo
Branches
Unknown
Tags
Unknown