-
Notifications
You must be signed in to change notification settings - Fork 3.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
Add caching and service worker docs to the web FAQ #11397
Conversation
Visit the preview URL for this PR (updated for commit 50360f3): https://flutter-docs-prod--pr11397-caching-and-service-workers-77emc0en.web.app |
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.
A few little things. I'll go ahead and LGTM, but please fix. :)
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
This is already published! Thanks @johnpryan! |
@johnpryan @ditman
<script src="flutter_bootstrap.js?v=123" async></script> is naïve, and has to be like bash script from flutter/flutter#127459 (comment) |
Do you think we should just remove it? This section is only necessary if you need to clear the web cache immediately after deploying a new version, which is probably not a requirement for most apps. If you have a link we can point to for better guidance I'd be happy to replace it.
What would those additional examples look like? We are providing a Firebase example in the FAQ now.
This is an interesting approach - have you had any issues with it? Are you using a routing package like go_router?
I think it's a commonly used technique, but you're right it's not as simple as we describe in the docs. I'm happy to provide a link to a blog post or article that explains this technique. |
Of course not! But this section is very important and must provide a complete solution for Flutter Web's caching problems.
Firebase is fine, but it has to be more "generic" - i.e. which headers for which files, and then how to implement this strategy on different hosting platforms (e.g. Firebase, AWS, Azure, self-hosted Apache, Tomcat, ...). Perhaps the community could help here.
For me, it works great. But I'm using auto_route and not bothering about # in urls.
you may directly add this link to the docs flutter/flutter#127459 (comment) |
@slavap How are you redirecting people from the root of your domain to your versioned folder deployment? That's the bit that I haven't seen solved! |
@ditman not sure I’ve got your question. index.html is placed exactly the same as usual Flutter Web deployment, only the rest of files go to subfolder on the same level as index.html |
Ah, so you're updating your index.html to inject assets from |
@ditman The main point is that there is no need to do "heavy" editing of index.html, it is usually just enough to change "base href" as: <head>
<base href="web1234/"> |
Please support documenting the "subfolder"-approach. This a simple workaround for a major problem that has been around way too long.
For Deployment of e.g. version 1.1.3 you deploy your files to subfolder "my_project_1_1_3" and update index.html in the parent directory. |
@philitell it is a very bad workaround |
@zs-dima This workaround achieves the desired behaviour and is very easy to implement. What do you consider a "good" workaround for this issue? |
This adds some information about web caching and service workers to the web FAQ.
cc/ @ditman @kevmoo