Page MenuHomePhabricator

[lib][web][native] Remove sessionID redux field
ClosedPublic

Authored by inka on Jul 27 2023, 8:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jun 21, 10:26 PM
Unknown Object (File)
Fri, Jun 21, 10:26 PM
Unknown Object (File)
Fri, Jun 21, 10:26 PM
Unknown Object (File)
Tue, Jun 18, 10:11 PM
Unknown Object (File)
Tue, Jun 18, 10:10 PM
Unknown Object (File)
Tue, Jun 18, 10:09 PM
Unknown Object (File)
Wed, Jun 12, 10:02 PM
Unknown Object (File)
May 20 2024, 6:32 AM
Subscribers

Details

Summary

issue: https://linear.app/comm/issue/ENG-4457/refactor-sessionid-field
Removing sessionID redux field. It is now replaced by sessionID in keyserverStore

Test Plan

ran yarn flow-all.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lib/types/keyserver-types.js
15 ↗(On Diff #29140)

This comment was moved from redux-types.js

lib/utils/sanitization.js
310 ↗(On Diff #29140)

this fixes

Could not decide which case to select, since  case 1 [1] may work but if it doesn't  case 2 [2] looks promising too. To fix add a type annotation  to `keyserverStore` [3].Flow(speculation-ambiguous)

appearing in line 315

318 ↗(On Diff #29140)
Cannot assign object literal to `state` because  undefined [1] is incompatible with  null or undefined [2] in property `sessionID` of type argument  `KeyserverInfoType` [3] of property `keyserverStore`.Flow(incompatible-type)

It's very odd that an error appears after a different field is removed... and in a different type then those the error is related to...

Harbormaster returned this revision to the author for changes because remote builds failed.Jul 27 2023, 8:46 AM
Harbormaster failed remote builds in B21278: Diff 29140!
inka requested review of this revision.Jul 28 2023, 12:47 PM

Heads-up, it looks like you've not specified any reviewers

lib/utils/sanitization.js
318 ↗(On Diff #29140)

What happens if you do something like this:

if (state.sessionID) {
  state = { ...state, deviceToken: null };
} else {
  state = { ...state, deviceToken: null };
}
lib/utils/sanitization.js
318 ↗(On Diff #29140)

It sadly doesn't help

Cannot assign object literal to `state` because  undefined [1] is incompatible with  null or undefined [2] in property `sessionID` of type argument  `KeyserverInfoType` [3] of property `keyserverStore`.Flow(incompatible-type)

And since sessionID is now in keyserverStore, the code would be quite horrible

if (
      state.keyserverStore.keyserverInfos[
        Object.keys(state.keyserverStore.keyserverInfos)[0]
      ].sessionID
    )

The issue in sanitization.js was resolved by changes in D8644

michal added inline comments.
lib/types/keyserver-types.js
15 ↗(On Diff #29293)

Nit: shouldn't this go above NativeKeyserverInfo?

This revision is now accepted and ready to land.Aug 2 2023, 2:00 AM