qiankun icon indicating copy to clipboard operation
qiankun copied to clipboard

[Feature Request] isSlowNetwork should be a function / callback.

Open Mboulianne opened this issue 1 year ago • 0 comments

Background

In the prefetch logic, we check whether the connection is slow or fast before we do any prefetching: https://github.com/umijs/qiankun/blob/59da80eb9c0d18c95748dcceaba2f421deab1ed5/src/prefetch.ts#L34

The problem with that is that as soon as prefetch is imported, the const will be set and it won't change after that. If my connection was to change to a fast connection, the variable wouldn't be updated.

It also adds some challenge for unit tests.

It would also be great if we could bypass this fetch when prefetching an app.

Proposal

Make it so that isSlowNetwork is a function instead of a variable

Additional context

Add any other context or screenshots about the feature request here.

Mboulianne avatar Aug 23 '22 18:08 Mboulianne