Page MenuHomePhabricator

[native] Reintroduce `updateClientDBThreadStoreThreadInfos`
ClosedPublic

Authored by atul on Feb 15 2024, 1:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 11, 7:31 PM
Unknown Object (File)
Mon, Nov 25, 6:00 PM
Unknown Object (File)
Mon, Nov 25, 4:08 PM
Unknown Object (File)
Mon, Nov 25, 2:15 PM
Unknown Object (File)
Nov 7 2024, 3:08 AM
Unknown Object (File)
Oct 15 2024, 7:48 PM
Unknown Object (File)
Oct 15 2024, 7:48 PM
Unknown Object (File)
Oct 15 2024, 7:48 PM
Subscribers

Details

Summary

Similar to D11095, we reintroduce updateClientDBThreadStoreThreadInfos based heavily on the deprecated version. I specify the changes inline.


Depends on D11095

Test Plan

This gets consumed for the first time in the upcoming specialRoles migration where it will be tested implicitly.

Diff Detail

Repository
rCOMM Comm
Branch
arcpatch-D11097_1 (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul requested review of this revision.Feb 15 2024, 1:17 PM

Could you link to the code that you're reintroducing?

I specify the changes inline.

This seems to be missed.

This revision is now accepted and ready to land.Feb 16 2024, 2:27 AM

Sorry, added annotation showing original code.

native/redux/client-db-utils.js
29–53 ↗(On Diff #37280)

Here's the code it's based on:

function deprecatedUpdateClientDBThreadStoreThreadInfos(
  state: AppState,
  migrationFunc: MixedRawThreadInfos => MixedRawThreadInfos,
  handleMigrationFailure?: AppState => AppState,
): AppState {
  // Get threads from SQLite `threads` table.
  const clientDBThreadInfos = commCoreModule.getAllThreadsSync();

  const operations = deprecatedCreateUpdateDBOpsForThreadStoreThreadInfos(
    clientDBThreadInfos,
    migrationFunc,
  );

  // Try processing `ClientDBThreadStoreOperation`s and log out if
  //    `processThreadStoreOperationsSync(...)` throws an exception.
  try {
    commCoreModule.processThreadStoreOperationsSync(operations);
  } catch (exception) {
    console.log(exception);
    if (handleMigrationFailure) {
      return handleMigrationFailure(state);
    }
    return ({ ...state, cookie: null }: any);
  }

  return state;
}

As well as screenshot with correct syntax highlighting + type hints:

82faa1.png (1×2 px, 295 KB)

This revision was landed with ongoing or failed builds.Feb 20 2024, 12:19 PM
This revision was automatically updated to reflect the committed changes.