mglaman / wasm-drupal

Drupal in WASM
https://wasm-drupal.mglaman.dev/
MIT License
22 stars 2 forks source link

Errors on first load from sendMessage before service worker is installed and activated #14

Closed mglaman closed 6 days ago

mglaman commented 1 week ago

When first visiting, there is an error from the check to see if there is an installed instance:

const checkWww = await sendMessage('analyzePath', ['/persist/drupal'])

Inside the DOMContentLoaded event, we need to ensure the service worker has been activated. We cannot use await serviceWorker.register() since we're in a function and the service worker is a module.

Using await to get the service worker registration doesn't seem to work either.