HomePhabricator
Diffusion Comm 8ef214ac1d76

[native] Make sure we finish saving Entry before deleting

Description

[native] Make sure we finish saving Entry before deleting

Summary:
Now that onBlur from TextInput fires earlier (see here), when you press the delete button on an Entry it first starts to save.

As a result of this, I was occasionally seeing a race condition where we'd get a concurrent_modification error on the entry deletion request to the keyserver. This would occur because the save already went through, and the prevText on the deletion (the text before modification) would not match the updated text in MariaDB. Other times, the query to check the text in MariaDB for the deletion request would run before the query that updates the text for the save request, and no issue would be observed.

This diff addresses the race condition by making sure we finish the save before we start the delete. I basically just extended the existing needsDeleteAfterCreation behavior, which I renamed to needsDeleteAfterSave.

Depends on D12263

Test Plan: Type an entry and then press the delete button. On web, confirm that it appears in the history, but it otherwise missing

Reviewers: tomek

Reviewed By: tomek

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

Details

Provenance
ashoatAuthored on May 31 2024, 4:03 PM
Reviewer
tomek
Differential Revision
D12264: [native] Make sure we finish saving Entry before deleting
Parents
rCOMM710a91939e95: [native] Fix Entry deletion after creation
Branches
Unknown
Tags
Unknown