Skip to content

[Flutter web] Assets are downloaded again in the 2nd visit despite service worker #115336

@david-landeros

Description

@david-landeros

Hello, I'm working on a project that is performance-sensitive, I need to squeeze every available resource in the HTML5 world to enhance performance and loading times.

Flutter apps download assets again in the second visit despite service worker, I know this happens because there is no call to
self.clients.claim();

Is there a reason why self.clients.claim() is not being called? Imo this is a desirable behavior by default or at least it should be a feature you can enable via environment.defines

Steps to Reproduce

  1. create a new project flutter create example
  2. build it for the web flutter build web
  3. serve it python3 -m http.server
  4. load the app for the first time
  5. reload the app and notice how assets added by the app developer are downloaded again

Expected results: service worker should kick in right away
Actual results: service worker start caching things after the second session

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)e: flutter.jsIssues with Flutter web custom initialization through JS APIsfound in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versiontoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions