qiankun
qiankun copied to clipboard
[Feature Request] isSlowNetwork should be a function / callback.
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.