Page MenuHomePhabricator

[lib] Handle `pinnedCount` in `convertClientDBThreadInfoToRawThreadInfo`
ClosedPublic

Authored by atul on Apr 24 2023, 11:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 3, 9:29 PM
Unknown Object (File)
Sat, Aug 31, 1:26 AM
Unknown Object (File)
Mon, Aug 26, 4:05 PM
Unknown Object (File)
Mon, Aug 26, 12:57 AM
Unknown Object (File)
Sun, Aug 25, 1:15 PM
Unknown Object (File)
Wed, Aug 7, 8:19 PM
Unknown Object (File)
Jul 21 2024, 5:08 AM
Unknown Object (File)
Jul 20 2024, 4:26 PM
Subscribers

Details

Summary

Even after persist.js migration 36 it looked like the threadInfos stored on the client were missing the pinnedCount field.

After taking a look at CommCoreModule it seemed like everything was good. However, noticed that convertClientDBThreadInfoToRawThreadInfo was missing pinnedCount entirely. This means that RawThreadInfos we get from SQLite will ALWAYS have pinnedCount stripped out even if it is properly persisted in SQLite.

Test Plan

Ongoing... as a start will check SET_CLIENT_DB_STORE action in Redux Dev Tools and see if ThreadInfos include pinnedCount field.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.Apr 24 2023, 11:19 AM
ashoat requested changes to this revision.Apr 24 2023, 11:22 AM

I don't think this is correct. You'll exclude pinnedCount if it's 0, whereas the keyserver always includes it, which will mean that there will be inconsistency

Is there a reason we shouldn't always just include pinnedCount?

This revision now requires changes to proceed.Apr 24 2023, 11:22 AM
lib/utils/thread-ops-utils.js
57–62 ↗(On Diff #25612)

Intentionally left this out of the let rawThreadInfo block even though we expect going forward this to be number where it's 0 if "unset."

We use convertClientDBThreadInfoToRawThreadInfo in previous migrations where we DON'T yet have pinnedCount... it's probably fine to have an extraneous pinnedCount field in those migrations, but figure it's safer to include this check.

Open to changing

check if not null and not undefined instead of truthiness

I don't think this is correct. You'll exclude pinnedCount if it's 0

Thanks for catching that, was hasty in putting this up. Will update.

Is there a reason we shouldn't always just include pinnedCount?

This was my reasoning:

Intentionally left this out of the let rawThreadInfo block even though we expect going forward this to be number where it's 0 if "unset."

We use convertClientDBThreadInfoToRawThreadInfo in previous migrations where we DON'T yet have pinnedCount... it's probably fine to have an extraneous pinnedCount field in those migrations, but figure it's safer to include this check.

but you're right we can probably just always include. Will update this diff again.

This revision is now accepted and ready to land.Apr 24 2023, 12:28 PM

Thanks for catching this!

This revision was landed with ongoing or failed builds.Apr 25 2023, 10:35 AM
This revision was automatically updated to reflect the committed changes.