-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add a serviceworker #234
Add a serviceworker #234
Conversation
config/auto-sw-plugin/index.js
Outdated
return true; | ||
}); | ||
} | ||
\ await Promise.all(serviceWorkers.map( |
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.
Syntax 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.
No idea how this got in there. We don't have an eslint config anymore though, should have caught this.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
sigh I broke the typings rather than fixing them. Will push a fix when I figure it out. |
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.
I approve Jason's changes here. Someone else should review mine 😀
@developit during dev I'm getting a |
I'm going to do more UI work around this, but I'll do that against one of the UI branches I already have to avoid conflicts. |
Weird, no idea what |
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.
Mostly nits and documentation from my side
@@ -153,6 +154,12 @@ async function processSvg(blob: Blob): Promise<HTMLImageElement> { | |||
return blobToImg(new Blob([newSource], { type: 'image/svg+xml' })); | |||
} | |||
|
|||
async function getOldestServiceWorker() { |
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.
“Oldest” seems a bit weird. “MostRecent”?
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.
Those are opposites 😄. Would you prefer LeastRecent? I thought "oldest" was an easier way to say that.
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.
Oh I understand now. It’s kinda weird to classify them in a temporal way.
From looking at the usage, you want the one that is “closest” to being active, no? So maybe something like getMostActiveServiceWorker()
?
🚲🏚
// In production, this entire condition is removed. | ||
if (process.env.NODE_ENV === 'development') { | ||
// In production, install a Service Worker | ||
if (process.env.NODE_ENV !== 'production') { |
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.
How does this change make ServiceWorker not install in development?
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.
not sure what happened with GH's comments but this line isn't in the current source.
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.
LOL
'process-', | ||
]; | ||
|
||
const prefixMatches = buildAssets.filter( |
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.
Minor nit: Put this in a function like assetsWithPrefix(...prefix: string): string[]
?
093554d
to
b689f4e
Compare
This reverts commit 7d42d4f.
Oops, wasn't meant to merge this one without addressing the nits. Will make those changes on master. |
* Add a serviceworker * rename + fix random extra character * Fixing worker typings * Fixing types properly this time. * Once of those rare cases where this matters. * Naming the things. * Move registration to the app (so we can use snackbar later) * Moving SW plugin later so it picks up things like HTML * MVP service worker * Two stage-service worker * Fix prerendering by conditionally awaiting Custom Elements polyfill. * Fix icon 404's * add doc comment to autoswplugin * Fix type
Still a few bits to polish, but it works. Same tenchnique we have for workers.