:rocket: If you are wondering How to Make a Compos...
# feed
k
🚀 If you are wondering How to Make a Compose Web Application Work Offline youtrack.jetbrains.com/issue/CMP-10781
K 5
s
Rather than providing documentation, could the generation of the service worker and everything else required be automated? For example, by setting a property such as
offlineAvailable = true
, which would then trigger all the necessary code to be generated automatically?
k
I agree that this could eventually be automated, but I’m hesitant to make a Service Worker a simple opt-in default (such as offlineAvailable = true). Service Workers are relatively sensitive infrastructure. As soon as customization is required, this would likely need a full—and potentially verbose—DSL or API for configuring caching strategies, cache invalidation, update behavior, network fallbacks, API requests, and other details. A Service Worker also continues running on the user’s side after deployment. When its behavior changes between application versions, maintaining compatibility and handling updates still becomes the developer’s responsibility, especially for customized setups. In addition, different applications may have very different requirements for cache contents and caching behavior. Some may only need the application shell to work offline, while others may also need specific API responses, runtime assets, or custom invalidation rules. For these reasons, I think it is safer to provide documentation and an explicit implementation for now rather than hide these decisions behind a single flag. That said, I agree that once we collect enough feedback on the common use cases, we could provide a built-in solution for the most typical scenario, while still allowing more advanced configurations when needed.
👍 1
👍🏾 1
s
this would likely need a full—and potentially verbose—DSL or API for configuring caching strategies, cache invalidation, update behavior, network fallbacks, API requests, and other details.
Nice idea, please give me that. 🙂
For these reasons, I think it is safer to provide documentation and an explicit implementation for now
I have that in my web apps, but it's basically all copy & paste from the first project.
we could provide a built-in solution for the most typical scenario
👌
r
How come this is a youtrack ticket rather than a docs page or blog post? It's not clear to me what the expected outcome of the ticket is, and this seems less discoverable if someone is trying to research how to do this.
m
Together with Claude I also put together some material on this topic. It works for me: mpmediasoft.de/articles/blog-pwa-updates-and-caching/blog-pwa-updates-and-caching.html
k
This is exactly a ticket for the tech writer team to prepare and to publish a dedicated doc page about that. I just wrote a technical info there. Here is (in the slack) non formal channel for communication between us and you (enthusiasts) so, I decided to share it with you. To hear your feedback and give a useful, I hope, info. Something is not right?
r
That makes sense. I just couldn't understand the intention from reading the ticket