Page MenuHomePhabricator

[lib][native] create action to set latest `backupID` on User Keys upload
ClosedPublic

Authored by kamil on Tue, Nov 26, 8:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 5:50 PM
Unknown Object (File)
Mon, Dec 16, 1:39 PM
Unknown Object (File)
Sun, Dec 15, 11:12 AM
Unknown Object (File)
Tue, Dec 10, 1:14 PM
Unknown Object (File)
Tue, Dec 10, 5:37 AM
Unknown Object (File)
Sun, Dec 8, 11:09 AM
Unknown Object (File)
Thu, Dec 5, 6:05 AM
Unknown Object (File)
Thu, Dec 5, 3:14 AM
Subscribers

Details

Summary

ENG-9701.

Depends on D14049

Test Plan

Call this code:

void dispatchActionPromise(
  createUserKeysBackupActionTypes,
  createUserKeysBackup(),
);

and check if it worked

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Tue, Nov 26, 8:08 AM
kamil edited the summary of this revision. (Show Details)
tomek added inline comments.
lib/actions/backup-actions.js
4–6 ↗(On Diff #46084)

Are you sure we need to use the dispatchActionPromise? Why a single action won't suffice?

lib/reducers/backup-reducer.js
16 ↗(On Diff #46084)

The reducer should be pure - in this case, every time it is called, the result will be different. The correct way to solve this issue is to generate the timestamp and put it into action.

This revision is now accepted and ready to land.Wed, Nov 27, 7:25 AM
lib/actions/backup-actions.js
4–6 ↗(On Diff #46084)

It will, but I recall receiving feedback in the past that doing something like:

await promise();
dispatch({});

is an antipattern, and whenever having a promise, we should aim to use dispatchActionPromise even if .started and .failed actions are not used.