Page MenuHomePhabricator

[kesyerver][lib][native][web] Move actualizedCalendarQuery out of connection
ClosedPublic

Authored by inka on Aug 30 2023, 2:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jul 1, 7:25 AM
Unknown Object (File)
Tue, Jun 25, 11:51 AM
Unknown Object (File)
Tue, Jun 25, 9:34 AM
Unknown Object (File)
Tue, Jun 25, 9:34 AM
Unknown Object (File)
Tue, Jun 25, 9:34 AM
Unknown Object (File)
Tue, Jun 25, 9:34 AM
Unknown Object (File)
Tue, Jun 25, 9:34 AM
Unknown Object (File)
Tue, Jun 25, 9:30 AM
Subscribers

Details

Summary

issue: https://linear.app/comm/issue/ENG-4460/refactor-connection-field
We have code inside of reduceConnectionInfo that reduces connection field on rehydrateActionType action. It returns the default connection with the exception of actualizedCalendarQuery field, that we want to get rehydrated. Redux is implemented in such a way, that if the state returned after the rehydrate action is dispatched is not the rehydrated state, the rehydrated state is ignored. see source code for details: https://github.com/rt2zz/reduxpersist/blob/master/src/stateReconciler/autoMergeLevel1.ts#L23 https://github.com/rt2zz/redux-persist/blob/master/src/persistReducer.ts#L170.
This wasn't causing problems before, but we want to move connection field to keyserverStore. So changing the connection on rehydrate action causes the rest of keyserverStore to not get rehydrated.
Moreover, there is no point in having actualizedCalendarQuery inside of the keyserverStore - the query will be the same for all keyservers. There isn't even really a good reason why actualizedCalendarQuery was in the connection field in the first place, from what I can tell. It can be reduced completly independantly, and their use cases are quite different. So I'm moving actualizedCalendarQuery out of connection, and in next diffs I will

  1. Stop reducing connection on rehydrate action and instead remove it from persistence
  2. put the connection field inside of keyserverStore.
Test Plan

Ran yarn flow-all, checked that the actualizedCalendarQuery is reduced and rehydrated correctly.
EDIT: tested the migration

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

inka requested review of this revision.Aug 30 2023, 2:55 AM
inka planned changes to this revision.Aug 30 2023, 3:22 AM

I need to write a migration

michal added inline comments.
lib/types/socket-types.js
488–494 ↗(On Diff #30542)

Should we just change to a const variable?

native/redux/persist.js
145–146 ↗(On Diff #30542)

Shouldn't this be like this?

This revision is now accepted and ready to land.Aug 30 2023, 5:52 AM