braid-http 1.3.107 → 1.3.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/braid-http-client.js +9 -4
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -324,13 +324,18 @@ async function braid_fetch (url, params = {}) {
|
|
|
324
324
|
if (!is_nodejs && params.headers.has('subscribe')) {
|
|
325
325
|
var nav_entry = performance?.getEntriesByType?.('navigation')?.[0]
|
|
326
326
|
if (nav_entry?.type === 'back_forward'
|
|
327
|
-
&& document.readyState !== 'complete')
|
|
327
|
+
&& document.readyState !== 'complete') {
|
|
328
|
+
|
|
329
|
+
// ...we wait until the page has loaded to send this fetch,
|
|
330
|
+
// because Chrome's SKIP_CACHE_VALIDATION policy goes away
|
|
331
|
+
// once the page loads.
|
|
328
332
|
|
|
329
|
-
// ...we just wait until the page has loaded to send this fetch
|
|
330
333
|
await new Promise(r => window.addEventListener('load', r))
|
|
331
334
|
|
|
332
|
-
//
|
|
333
|
-
//
|
|
335
|
+
// In practice, waiting for 'load' alone isn't enough;
|
|
336
|
+
// we also need this setTimeout(0) for it to work reliably.
|
|
337
|
+
await new Promise(done => setTimeout(done, 0))
|
|
338
|
+
}
|
|
334
339
|
}
|
|
335
340
|
|
|
336
341
|
// Braid-Chrome needs the following special (undocumented)
|