GoogleChromeLabs / react-adaptive-hooks

Deliver experiences best suited to a user's device and network constraints
Apache License 2.0
5.11k stars 114 forks source link

[docs] How to avoid fetching different assets during fluctuations #28

Open astronomersiva opened 4 years ago

astronomersiva commented 4 years ago

Consider this scenario:

My phone is connected to WiFi(4g), the power goes off, and my mobile data(2g) kicks into action. If there were multiple assets fetched for 4g, all their low quality equivalents will now be fetched. This will also happen when I am travelling between places as my data speed keeps fluctuating.

I am not sure what the solution to this problem is but I believe we shouldn't be replacing assets that are already fully loaded.

addyosmani commented 4 years ago

This is a good gotcha to raise awareness around. We have thought about this and documented one pattern for addressing over-fetching using Service Workers in https://github.com/GoogleChromeLabs/adaptive-loading/tree/master/cra-network-aware-only-if-cached-loading.

I'm going to rename this issue and keep it open as a reminder to add a docs or wiki entry about how to address this particular consideration in a little more detail.

anton-karlovskiy commented 4 years ago

@addyosmani

I think we have one more approach which is not landed yet. https://github.com/GoogleChromeLabs/adaptive-loading/pull/27