-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: config loading on subdomains waits for updated config #94
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self review
the activate event is fired when the service worker is first activated, and then the channel.onmessagefrom event listener is set up. by the time the channel receives any messages, the event passed to activate will be done, and waitUntil has no effect (and throws an error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self review
debugLib.enable(config.debug ?? '') // set debug level first. | ||
log('config-debug: setting config %O for domain %s', config, window.location.origin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set debug level before calling log method so debug level is taken into consideration immediately.
@@ -27,20 +27,13 @@ export default function RedirectPage (): JSX.Element { | |||
async function doWork (config: ConfigDb): Promise<void> { | |||
try { | |||
await setConfig(config) | |||
// TODO: use channel.messageAndWaitForResponse to ensure that the config is loaded before proceeding. | |||
channel.postMessage({ target: 'SW', action: 'RELOAD_CONFIG' }) | |||
// TODO: show spinner / disable buttons while waiting for response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
things happen pretty fast so i don't think we want a spinner or other things, but maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self review of some more minor improvements and manual config update verification
* refactor: remove unused helia andu se verified fetch * chore: remove empty line * fix: load config iframe using a hash fragment fixes #88 * fix: load default config initially * chore: fix linting errors * chore: remove unused deps * chore: re-add needed @helia/ipns dependency * fix: set verifiedFetch when sw is activated * chore: remove lib/heliaFetch and cleanup sw.ts (#95) * fix: config loading on subdomains waits for updated config (#94) * fix: config loading on subdomains waits for updated config * fix: remove event.waitUtil inside channel.onmessagefrom the activate event is fired when the service worker is first activated, and then the channel.onmessagefrom event listener is set up. by the time the channel receives any messages, the event passed to activate will be done, and waitUntil has no effect (and throws an error) * fix: service worker handles being disposed of * fix: preload request from redirect page is handled by sw * chore: better trace logging for config updates --------- Co-authored-by: Daniel N <[email protected]> Co-authored-by: Russell Dempsey <[email protected]>
Great stuff! |
Title
fix: config loading on subdomains waits for updated config
Description
Minor updates to #89
Addresses the issue brought up in #89:
Notes & open questions
Demo
2024-03-07.at.18.17.23.-.Plum.Anglerfish.mp4
Change checklist