-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Remove the service worker and ui.USE_SERVICE_WORKER option #11528
Conversation
We don't really gain anything from it except the client-side caching which is a problem better solved on HTTP level. Gitea is not a PWA and will not do anything useful in a offline scenario without having access to the server. This should also resolve issues seen with the serviceworker interfering on SSE requests. The only API we can not use without a service worker is push notifications while the "app" is closed but the more established HTML Notification API will be a alternative. Fixes: go-gitea#11092 Fixes: go-gitea#8056 Fixes: go-gitea#7372
Probably this needs more than just two approvals |
Might considering marking this as breaking; I'm sure people that actively use Gitea as PWA (as much as it isn't meant to be) would consider it as such. |
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 wonder if there is any way that this could be added back manually (without code change) for those that want it, through custom content or something similar.
I may try to play with it and add docs or contrib if this gets merged.
plreace resolve conflict |
@@ -1048,10 +1048,6 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
ctx.HTML(200, "pwa/manifest_json") |
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.
should we change this also?
Why not just change the default option to false? |
That means we would still have and support a broken configuration; specifically with SSE request being killed by SW |
I'm unsure whether to go ahead because SW cache may be more reliable than HTTP-based caches. It should have a performance advantage overall: https://stackoverflow.com/a/47972445/808699 Regarding the SSE issue, I'm not sure if SW is really the source of the issues. We have it configured as a static list of resources to cache and non-matches should always hit the network. |
I'll close this and follow up with a better approach to the SW (which in itselfs still seems valuable to keep for performance) using workbox with destination-based caching. This will also free us from the burden of having to manually keep that file up to date. |
But the request that hits network is intercepted by SW, and SW are not supposed to be working forever; hence Firefox kills it after 30s, breaking SSE. There really should be some way to mark SSE connection so that it is never intercepted by SW in the first place, but it seems there isn't and SW dying closes SSE connection. Do we really need to additionally burden Gitea with libraries designed for offline usage, such as workbox? They explicitly say
As far as I am concerned; and you confirmed, Gitea isn't such and won't be. |
As discussed, the SSE issue should be because the SW unconditionally handled all requests. Should be fixed in #11538 which only intercepts a subset of requests. |
I'd say it's justified because when using serviceworkers, we can guarantee at least some degree of caching which is important for performance because we do have some large assets (monaco) that really benefit from it. The current workbox implementation is only 28kB, so very lightweight. |
We don't really gain anything from it except the client-side caching which is a problem better solved on HTTP level. Gitea is not a PWA and will not do anything useful in a offline scenario without having access to the server.
This should also resolve issues seen with the serviceworker interfering on SSE requests.
The only API we can not use without a service worker is push notifications while the "app" is closed but the more established HTML Notification API will be a alternative.
Fixes: #11092
Fixes: #8056
Fixes: #7372