Page MenuHomePhabricator

[native] Reintroduce `updateClientDBThreadStoreThreadInfos`
ClosedPublic

Authored by atul on Feb 15 2024, 1:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 12:22 AM
Unknown Object (File)
Thu, Apr 25, 12:49 PM
Unknown Object (File)
Thu, Apr 25, 12:48 PM
Unknown Object (File)
Feb 29 2024, 9:46 PM
Unknown Object (File)
Feb 28 2024, 6:38 PM
Unknown Object (File)
Feb 26 2024, 11:09 AM
Unknown Object (File)
Feb 25 2024, 10:42 AM
Unknown Object (File)
Feb 24 2024, 7:56 AM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.