Skip to content

Commit 78833cb

Browse files
authored
Improve duplicate middleware error and save build output (#4928)
1 parent e730507 commit 78833cb

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

errors.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@
4040
"38": "Cannot refetch a query that has not been started yet.",
4141
"39": "called \\`injectEndpoints\\` to override already-existing endpointName without specifying \\`overrideExisting: true\\`",
4242
"40": "maxPages for endpoint '' must be a number greater than 0",
43-
"41": "getPreviousPageParam for endpoint '' must be a function if maxPages is used"
43+
"41": "getPreviousPageParam for endpoint '' must be a function if maxPages is used",
44+
"42": "Duplicate middleware references found when creating the store. Ensure that each middleware is only included once."
4445
}

packages/toolkit/src/configureStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export function configureStore<
187187
finalMiddleware.forEach((middleware) => {
188188
if (middlewareReferences.has(middleware)) {
189189
throw new Error(
190-
'Duplicate middleware found. Ensure that each middleware is only included once',
190+
'Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.',
191191
)
192192
}
193193
middlewareReferences.add(middleware)

packages/toolkit/src/query/tests/injectEndpoints.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe('injectEndpoints', () => {
115115
})
116116

117117
expect(makeStore).toThrowError(
118-
'Duplicate middleware found. Ensure that each middleware is only included once',
118+
'Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.',
119119
)
120120
})
121121
})

packages/toolkit/src/tests/configureStore.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ describe('configureStore', async () => {
143143
}
144144

145145
expect(makeStore).toThrowError(
146-
'Duplicate middleware found. Ensure that each middleware is only included once',
146+
'Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.',
147147
)
148148
})
149149

0 commit comments

Comments
 (0)