This differential enables olm usage in notifications service-worker on web.
Details
- Apply this diff (in order to actually initialize olm with WASM file since eventually it will be initialised when receiving notification in next diff): https://gist.github.com/marcinwasowicz/20ee184547487d05aa5421af8c77b107
- Open web app.
- In new tab open chrome://inspect/#workers
- Go to Service Workers then worker/notif and finally click inspect. This should open a console.
- Finally reload web app and ensure that no error is logged.
Repeat for prod and dev
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
In the past I had some issues with testing it related to caching, it might be good to repeat the test with a disabled cache.
web/database/utils/constants.js | ||
---|---|---|
11 ↗ | (On Diff #32502) | that's on me, but feel like this should be something like WORKERS_MODULE_DIR_PATH as this not lead to file and could confuse someone |
web/webpack.config.cjs | ||
172–184 ↗ | (On Diff #32502) | looks like this will cause downloading this file twice, once for the app and the second time for the worker but probably there is no easy and better solution, but it's downloaded only on the first time or on olm update |
Don't initialize olm when receiving WASM path but store it in IndexedDB. This is necessary since any global state kept within service-worker can be wiped anytime
without notice. That said we need to keep WASM path and initialize olm when receiving notification in case its state was wiped out.