Page MenuHomePhabricator

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

Authored by atul on Apr 24 2023, 11:14 AM.
Tags
None
Referenced Files
F3175875: D7587.id25614.diff
Thu, Nov 7, 8:19 PM
F3174818: D7587.id25612.diff
Thu, Nov 7, 6:15 PM
Unknown Object (File)
Thu, Oct 31, 3:34 PM
Unknown Object (File)
Thu, Oct 31, 3:34 PM
Unknown Object (File)
Thu, Oct 31, 3:34 PM
Unknown Object (File)
Thu, Oct 31, 3:34 PM
Unknown Object (File)
Thu, Oct 31, 3:34 PM
Unknown Object (File)
Thu, Oct 31, 3:34 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
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

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.