You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running an app that uses prefetch while throttling the network ("Slow 3G" mode on Chrome). When doing so, prefetch(url) returns undefined instead of a Promise.
When the network is throttled on "Slow 3G", the output of navigator.connection is as follows:
So, in my case described above, we're not going into that if statement, and the function implicitly returns undefined. When chaining prefetch(url) with catch, this raises a runtime error.
I saw that the library uses microbundle, which I'm not familiar with, so I'm not aware of stripping behavior. At first glance, no apparent options seem to remove such code.
Once the root cause of the missing code is identified, it could be a nice improvement to also run tests in a slow environment. Since the project already uses Puppeteer, it should be able to interact with Chrome DevTool's Network.emulateNetworkConditions and change the latency and network throughput.
The text was updated successfully, but these errors were encountered:
If you throttle network to slow 3g,
window.navigator.connection.effectiveType === '2g'
And because of it prefetch function returns undefind (return; === return undefind;). Probably they should return Promise.resolve(undefind)
Describe the bug
I'm running an app that uses
prefetch
while throttling the network ("Slow 3G" mode on Chrome). When doing so,prefetch(url)
returnsundefined
instead of a Promise.When the network is throttled on "Slow 3G", the output of
navigator.connection
is as follows:Given the precondition in the
prefetch
function, the function should return a rejected promise. However, it looks like in the production bundle, bothPromise.reject
statements are gone.Here's a (beautified) snapshot of the relevant code chunk in the shipped
quicklink.js
from mynode_modules
:So, in my case described above, we're not going into that
if
statement, and the function implicitly returnsundefined
. When chainingprefetch(url)
withcatch
, this raises a runtime error.I saw that the library uses
microbundle
, which I'm not familiar with, so I'm not aware of stripping behavior. At first glance, no apparent options seem to remove such code.To Reproduce
undefined
in the browser console.Expected behavior
I'd expect
prefetch
always to return a Promise, as documented.Version:
Additional context, screenshots, screencasts
Here's a screenshot of the linked sandbox.
Once the root cause of the missing code is identified, it could be a nice improvement to also run tests in a slow environment. Since the project already uses Puppeteer, it should be able to interact with Chrome DevTool's
Network.emulateNetworkConditions
and change the latency and network throughput.The text was updated successfully, but these errors were encountered: