HomePhabricator
Diffusion Comm af44ff07bbe8

[Flow202][web][skip-ci] [21/x] Avoid localforage.getItem with unclear type…

Description

[Flow202][web][skip-ci] [21/x] Avoid localforage.getItem with unclear type param for web encryption key

Summary:
After rebasing my Flow upgrade stack, I noticed a bunch of new errors: https://gist.github.com/Ashoat/b83564168fda704b2ce9d8051d0f472e

I played around a bit and it seems like an incompatibility between CryptoKey and SubtleCrypto$JsonWebKey introduced in D9535 and D9661, here and here.

@marcin's proposed this solution, which addresses the issue by avoiding calling localforage.getItem in a situation where the type param is ambiguous.

NOTE: CI will fail on this diff. I considered the possibility of fixing Flow errors BEFORE upgrading Flow, but it wasn't possible... in some cases, the fixes to support the new version of Flow caused errors in the old version. I could have hidden these type errors with $FlowFixMe lines and then later revert those, but that seemed like too much busy work.

Depends on D9786

Test Plan: Confirm the Flow errors go away

Reviewers: marcin, michal, kamil

Reviewed By: marcin

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D9984

Event Timeline

I thought we agreed on not altering CryptoKey (since it is actually correct) but on adding specific type annotations to data we fetch from database. Why was the original approach landed?

Oops – sorry @marcin, this was a mistake on my part. I accidentally discarded the updated diff due to a rebasing mistake. I'll put up another diff to fix this momentarily.