Webapp on safari didn't correctly initialize the database and so rehydration failed. Because cookies are now stored in redux it also meant that the user was logged out.
The problem was that the async call to getSafariEncryptionKey (which only happens on safari) wasn't in this.initPromise. That meant we could end up in a situation where this.status is INIT_IN_PROGRESS but initPromise is undefined. This broke logic in isDatabaseSupported which assumed that these two variables would be always in sync.
Details
Details
Added logs to DatabaseModule.isDatabaseSupported and commReduxStorageEngine.getItem (which tries to get data from sqlite and internally calls isDatabaseSupported)
Without changes in this diff:
- Reloaded the website
- From logs in isDatabaseSupported we can see that
- this.status is INIT_IN_PROGRESS which is correct
- But this.initPromise in undefined
- isDatabaseSupported call in getItem returns false and rehydration fails
- User is logged out
With changes:
- Reloaded the website
- Now this.initPromise contains a pending promise
- isDatabaseSupported call in getItem returns true
- User is remains logged in
Diff Detail
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Additionaly link the init in progress status to the init promise with types, so we won't get this situation in the future (an async operation between setting the status and setting the init promise).
web/database/database-module-provider.js | ||
---|---|---|
32–34 ↗ | (On Diff #32845) | Can this be readonly? |