Page MenuHomePhabricator

[lib] Remove `lastNavigatedTo/lastPruned` from `MessageStore.threads`
ClosedPublic

Authored by atul on Oct 12 2023, 9:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 28 2024, 8:18 PM
Unknown Object (File)
Oct 25 2024, 1:15 AM
Unknown Object (File)
Oct 2 2024, 1:05 PM
Unknown Object (File)
Oct 2 2024, 1:05 PM
Unknown Object (File)
Oct 2 2024, 6:01 AM
Unknown Object (File)
Sep 22 2024, 6:13 AM
Unknown Object (File)
Sep 7 2024, 1:51 AM
Unknown Object (File)
Aug 13 2024, 1:13 PM
Subscribers

Details

Summary

All of the message pruning logic is now dependent on lastNavigatedTo and lastPruned from ThreadActivityStore instead of MessageStore.threads, so instances of MessageStore.threads.[lastNavigatedTo/lastPruned]` can safely be removed.

This diff just handles removal on the "JS side." We will separately handle removal on the C++ side.

NOTE: I originally intended to migrate values from MessageStore.threads to ThreadActivityStore, but decided against it. I will still introduce a migration to remove the extraneous lastNavigatedTo and lastPruned from MessageStore.threads, but figure it makes sense to start with ThreadActivityStore empty and be populated lazily instead of immediately filling with up with entries for every thread.

Depends on D9469

Test Plan

Putting this up now, but need to do more testing before landing so marking this as DRAFT. This should all be "dead code."

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.Oct 12 2023, 9:21 PM
atul retitled this revision from [DRAFT][lib] Remove `lastNavigatedTo/lastPruned` from `MessageStore.threads` to [lib] Remove `lastNavigatedTo/lastPruned` from `MessageStore.threads`.Oct 13 2023, 11:54 AM
ashoat added a reviewer: kamil.
ashoat added a subscriber: kamil.

In a meeting with @kamil today, he indicated that MessageStore.threads was in the process of being moved to SQLite. Have you synced with @kamil to make sure this won't conflict with that work? (Figure it would be a good idea for him to review this diff as well.)

I will still introduce a migration to remove the extraneous lastNavigatedTo and lastPruned from MessageStore.threads

Is there a diff or task tracking that? Does landing this diff need to be blocked on that, or can it be landed as-is?

lib/types/message-types.js
389–390 ↗(On Diff #31979)

Can these fields be made read-only? We should always aim to improve types when we touch them

lib/utils/message-ops-utils.js
273–274 ↗(On Diff #31979)

We will separately handle removal on the C++ side.

Is there a diff or task tracking that? Does landing this diff need to be blocked on that, or can it be landed as-is?

Looks good but also curious about answers to @ashoat's questions

In a meeting with @kamil today, he indicated that MessageStore.threads was in the process of being moved to SQLite.

It's already in SQLite, the only thing is that we have it in both SQLite and redux-persist to assert correctness. There is a task where we synced with @atul: ENG-3743.

This revision is now accepted and ready to land.Oct 17 2023, 2:16 AM
In D9475#278685, @kamil wrote:

Looks good but also curious about answers to @ashoat's questions

In a meeting with @kamil today, he indicated that MessageStore.threads was in the process of being moved to SQLite.

It's already in SQLite, the only thing is that we have it in both SQLite and redux-persist to assert correctness. There is a task where we synced with @atul: ENG-3743.

That work should be able to continue without issue. We'll still proceed w/ moving MessageStore.threads to SQLite, MessageStore.threads will just have lastNavigatedTo and lastPruned fields dropped. I handle clearing the extraneous fields from both Redux + SQLite in this stack.

lib/utils/message-ops-utils.js
273–274 ↗(On Diff #31979)

It's handled in subsequent diff in this stack. All diffs in this stack will be landed at once.

lib/types/message-types.js
389–390 ↗(On Diff #31979)

There's a flow issue here:

0a562f.png (576×1 px, 149 KB)

I'll put a quick followup diff at the end of this stack.


As an aside, wonder if we should use https://immerjs.github.io/immer/. Saw it mentioned in Redux docs a bunch of times.