flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.21k stars 26.64k forks source link

Loading Issue #147321

Open cleansterhq opened 3 weeks ago

cleansterhq commented 3 weeks ago

Steps to reproduce

Go to Cleanster.com Click on "Book Cleaning" It takes 30 second to load Why is this ?

Expected results

Should be fast

Actual results

30 to 45 seconds to load

Code sample

Code sample ```dart [Paste your code here] ```

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console [Paste your output here] ```
moffatman commented 3 weeks ago

Seems to be slow hosting. E.g. it took 2.5 seconds to transfer the 1.7MB main.dart.js

darshankawar commented 3 weeks ago

@cleansterhq Is the app built in flutter ? Also check above comment about slow hosting if that's the case with you.

cleansterhq commented 3 weeks ago

Yes it is built in Flutter + Dart . We use firebase to host. How do we increase the hosting ? image

cleansterhq commented 2 weeks ago

This is pulling from Firebase Hosting and there is no where to change the speed of firebase hosting . Can you please look into this closely :) @moffatman @darshankawar

darshankawar commented 2 weeks ago

@cleansterhq Does the slow hosting speed occurs only after deploying ? or locally as well in release mode ?

cleansterhq commented 2 weeks ago

@darshankawar only after deploying. We tested in incognito, and it seems to run a bit faster. However, it may have something to do with caching

We don't have a way to flush caching in Firebase hosting.

AndrewBrook-Google commented 2 weeks ago

The load time of main.dart.js is a bit slow but it doesn't seem to explain the many-seconds delays the customer is reporting.

There seems to be something timing out, according to this console error message:

Screenshot 2024-04-26 at 13 15 24
AndrewBrook-Google commented 2 weeks ago

(but note - I am not a web app or Flutter developer so I could be totally wrong!)

darshankawar commented 2 weeks ago

@cleansterhq if it is specific to firebase hosting, this isn't the correct repo to report slow hosting speed. You may want to check https://firebase.google.com/docs/hosting or reach out to firebase support for further resolution on cache clearing on it.

cleansterhq commented 2 weeks ago

We are testing AppCheck . Looks like Flutter for Web reCaptcha v3 is required. Since we enabled it without connecting reCaptcha

darshankawar commented 2 weeks ago

That will fall into flutterfire territory @cleansterhq . You may want to look at https://github.com/firebase/flutterfire/issues

cleansterhq commented 2 weeks ago

Finally I found that "Attestation check for Topics" is not related to AppCheck. This is part of experimental Topics API feature, and this is all about advertising. I have installed some configuration to Firebase Hosting that should disable it but no effect. AppCheck is added to Web and Mac apps. I little sense in it though because it is not supported for Windows. So, we can use it in monitoring mode only.

darshankawar commented 2 weeks ago

Thanks for the update @cleansterhq I am having feeling that the loading issue is related to firebase based on your recent findings. I suggest you to follow-up in firebase repo if you still have issues with loading time.

cleansterhq commented 1 week ago

@darshankawar looks like this is a well know issue for flutter web .

We are going to try this two:

https://stackoverflow.com/questions/78145531/optimizing-flutter-web-app-initial-load-times

https://www.dhiwise.com/post/improve-flutter-app-performance-with-optimization-strategies

cleansterhq commented 1 week ago

We will just have to use a loading image just to keep user engaged @darshankawar @moffatman cc @AndrewBrook-Google

darshankawar commented 1 week ago

@cleansterhq Is there a way for you to provide a reproducible code sample that shows the loading issue ? Also, please check below issues for further reference and see if it resembles your case or not:

https://github.com/flutter/flutter/issues/127704 https://github.com/flutter/flutter/issues/118115 https://github.com/flutter/flutter/issues/102828 https://github.com/flutter/flutter/issues/79706