msw 2.4.9 → 2.4.10

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.
@@ -8,7 +8,7 @@
8
8
  * - Please do NOT serve this file on production.
9
9
  */
10
10
 
11
- const PACKAGE_VERSION = '2.4.9'
11
+ const PACKAGE_VERSION = '2.4.10'
12
12
  const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
13
13
  const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
14
14
  const activeClientIds = new Set()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "msw",
3
- "version": "2.4.9",
3
+ "version": "2.4.10",
4
4
  "description": "Seamless REST/GraphQL API mocking library for browser and Node.js.",
5
5
  "main": "./lib/core/index.js",
6
6
  "module": "./lib/core/index.mjs",
@@ -36,17 +36,19 @@ export const getWorkerInstance = async (
36
36
  const [existingRegistration] = mockRegistrations
37
37
 
38
38
  if (existingRegistration) {
39
- // When the Service Worker is registered, update it and return the reference.
40
- return existingRegistration.update().then(() => {
41
- return [
42
- getWorkerByRegistration(
43
- existingRegistration,
44
- absoluteWorkerUrl,
45
- findWorker,
46
- ),
39
+ // Schedule the worker update in the background.
40
+ // Update ensures the existing worker is up-to-date.
41
+ existingRegistration.update()
42
+
43
+ // Return the worker reference immediately.
44
+ return [
45
+ getWorkerByRegistration(
47
46
  existingRegistration,
48
- ]
49
- })
47
+ absoluteWorkerUrl,
48
+ findWorker,
49
+ ),
50
+ existingRegistration,
51
+ ]
50
52
  }
51
53
 
52
54
  // When the Service Worker wasn't found, register it anew and return the reference.