Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
Browse files Browse the repository at this point in the history
…o remove-rtk-github-issues-example-sandbox
  • Loading branch information
aryaemami59 committed May 6, 2024
2 parents 631ac39 + 171f9e0 commit b4727a5
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 75 deletions.
3 changes: 1 addition & 2 deletions examples/query/react/pagination/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
"msw": "^0.40.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-icons": "3.11.0",
"react-icons": "^5.0.1",
"react-redux": "^9.1.0",
"react-router-dom": "6.3.0",
"react-scripts": "5.0.1"
},
"devDependencies": {
Expand Down
44 changes: 30 additions & 14 deletions examples/query/react/pagination/public/mockServiceWorker.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* eslint-disable */
/* tslint:disable */

/**
* Mock Service Worker.
* Mock Service Worker (0.40.2).
* @see https://github.com/mswjs/msw
* - Please do NOT modify this file.
* - Please do NOT serve this file on production.
*/
/* eslint-disable */
/* tslint:disable */

const INTEGRITY_CHECKSUM = '82ef9b96d8393b6da34527d1d6e19187'
const INTEGRITY_CHECKSUM = '02f4ad4a2797f85668baf196e553d929'
const bypassHeaderName = 'x-msw-bypass'
const activeClientIds = new Set()

Expand Down Expand Up @@ -82,11 +83,11 @@ self.addEventListener('message', async function (event) {
}
})

// Resolve the "master" client for the given event.
// Resolve the "main" client for the given event.
// Client that issues a request doesn't necessarily equal the client
// that registered the worker. It's with the latter the worker should
// communicate with during the response resolving phase.
async function resolveMasterClient(event) {
async function resolveMainClient(event) {
const client = await self.clients.get(event.clientId)

if (client.frameType === 'top-level') {
Expand All @@ -108,7 +109,7 @@ async function resolveMasterClient(event) {
}

async function handleRequest(event, requestId) {
const client = await resolveMasterClient(event)
const client = await resolveMainClient(event)
const response = await getResponse(event, client, requestId)

// Send back the response clone for the "response:*" life-cycle events.
Expand Down Expand Up @@ -220,13 +221,11 @@ async function getResponse(event, client, requestId) {

console.error(
`\
[MSW] Request handler function for "%s %s" has thrown the following exception:
[MSW] Uncaught exception in the request handler for "%s %s":
${parsedBody.errorType}: ${parsedBody.message}
(see more detailed error stack trace in the mocked response body)
${parsedBody.location}
This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error.
If you wish to mock an error response, please refer to this guide: https://mswjs.io/docs/recipes/mocking-error-responses\
This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/recipes/mocking-error-responses\
`,
request.method,
request.url,
Expand All @@ -241,6 +240,12 @@ If you wish to mock an error response, please refer to this guide: https://mswjs

self.addEventListener('fetch', function (event) {
const { request } = event
const accept = request.headers.get('accept') || ''

// Bypass server-sent events.
if (accept.includes('text/event-stream')) {
return
}

// Bypass navigation requests.
if (request.mode === 'navigate') {
Expand All @@ -264,11 +269,22 @@ self.addEventListener('fetch', function (event) {

return event.respondWith(
handleRequest(event, requestId).catch((error) => {
if (error.name === 'NetworkError') {
console.warn(
'[MSW] Successfully emulated a network error for the "%s %s" request.',
request.method,
request.url,
)
return
}

// At this point, any exception indicates an issue with the original request/response.
console.error(
'[MSW] Failed to mock a "%s" request to "%s": %s',
`\
[MSW] Caught an exception from the "%s %s" request (%s). This is probably not a problem with Mock Service Worker. There is likely an additional logging output above.`,
request.method,
request.url,
error,
`${error.name}: ${error.message}`,
)
}),
)
Expand Down
5 changes: 1 addition & 4 deletions examples/query/react/pagination/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { Route, Routes } from 'react-router-dom'
import { PostsManager } from './features/posts/PostsManager'

function App() {
return (
<Routes>
<Route path="*" element={<PostsManager />} />
</Routes>
<PostsManager />
)
}

Expand Down
3 changes: 0 additions & 3 deletions examples/query/react/pagination/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import App from './App'
import { api } from './app/services/posts'
import { ChakraProvider } from '@chakra-ui/react'

import { BrowserRouter } from 'react-router-dom'
import { worker } from './mocks/browser'
import { ApiProvider } from '@reduxjs/toolkit/query/react'

Expand All @@ -14,9 +13,7 @@ worker.start({ quiet: true }).then(() =>
<React.StrictMode>
<ApiProvider api={api}>
<ChakraProvider>
<BrowserRouter>
<App />
</BrowserRouter>
</ChakraProvider>
</ApiProvider>
</React.StrictMode>,
Expand Down
2 changes: 1 addition & 1 deletion packages/rtk-query-codegen-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"msw": "^2.1.5",
"node-fetch": "^3.3.2",
"openapi-types": "^9.1.0",
"pretty-quick": "^3.1.0",
"pretty-quick": "^4.0.0",
"rimraf": "^5.0.5",
"ts-node": "^10.9.2",
"vitest": "^1.2.2",
Expand Down
91 changes: 40 additions & 51 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5444,9 +5444,8 @@ __metadata:
msw: "npm:^0.40.2"
react: "npm:^18.1.0"
react-dom: "npm:^18.1.0"
react-icons: "npm:3.11.0"
react-icons: "npm:^5.0.1"
react-redux: "npm:^9.1.0"
react-router-dom: "npm:6.3.0"
react-scripts: "npm:5.0.1"
typescript: "npm:~4.9"
languageName: unknown
Expand Down Expand Up @@ -7620,7 +7619,7 @@ __metadata:
oazapfts: "npm:^4.8.0"
openapi-types: "npm:^9.1.0"
prettier: "npm:^3.2.5"
pretty-quick: "npm:^3.1.0"
pretty-quick: "npm:^4.0.0"
rimraf: "npm:^5.0.5"
semver: "npm:^7.3.5"
swagger2openapi: "npm:^7.0.4"
Expand Down Expand Up @@ -8707,13 +8706,6 @@ __metadata:
languageName: node
linkType: hard

"@types/minimatch@npm:^3.0.3":
version: 3.0.5
resolution: "@types/minimatch@npm:3.0.5"
checksum: 10/c41d136f67231c3131cf1d4ca0b06687f4a322918a3a5adddc87ce90ed9dbd175a3610adee36b106ae68c0b92c637c35e02b58c8a56c424f71d30993ea220b92
languageName: node
linkType: hard

"@types/nanoid@npm:^2.1.0":
version: 2.1.0
resolution: "@types/nanoid@npm:2.1.0"
Expand Down Expand Up @@ -10610,13 +10602,6 @@ __metadata:
languageName: node
linkType: hard

"array-differ@npm:^3.0.0":
version: 3.0.0
resolution: "array-differ@npm:3.0.0"
checksum: 10/117edd9df5c1530bd116c6e8eea891d4bd02850fd89b1b36e532b6540e47ca620a373b81feca1c62d1395d9ae601516ba538abe5e8172d41091da2c546b05fb7
languageName: node
linkType: hard

"array-flatten@npm:1.1.1":
version: 1.1.1
resolution: "array-flatten@npm:1.1.1"
Expand Down Expand Up @@ -10675,13 +10660,6 @@ __metadata:
languageName: node
linkType: hard

"arrify@npm:^2.0.1":
version: 2.0.1
resolution: "arrify@npm:2.0.1"
checksum: 10/067c4c1afd182806a82e4c1cb8acee16ab8b5284fbca1ce29408e6e91281c36bb5b612f6ddfbd40a0f7a7e0c75bf2696eb94c027f6e328d6e9c52465c98e4209
languageName: node
linkType: hard

"asap@npm:~2.0.3, asap@npm:~2.0.6":
version: 2.0.6
resolution: "asap@npm:2.0.6"
Expand Down Expand Up @@ -15235,7 +15213,7 @@ __metadata:
languageName: node
linkType: hard

"execa@npm:^4.0.0, execa@npm:^4.0.2":
"execa@npm:^4.0.2":
version: 4.1.0
resolution: "execa@npm:4.1.0"
dependencies:
Expand Down Expand Up @@ -17329,6 +17307,13 @@ __metadata:
languageName: node
linkType: hard

"ignore@npm:^5.3.0":
version: 5.3.1
resolution: "ignore@npm:5.3.1"
checksum: 10/0a884c2fbc8c316f0b9f92beaf84464253b73230a4d4d286697be45fca081199191ca33e1c2e82d9e5f851f5e9a48a78e25a35c951e7eb41e59f150db3530065
languageName: node
linkType: hard

"image-size@npm:^1.0.1":
version: 1.0.1
resolution: "image-size@npm:1.0.1"
Expand Down Expand Up @@ -20688,7 +20673,7 @@ __metadata:
languageName: node
linkType: hard

"mri@npm:^1.1.0, mri@npm:^1.1.5":
"mri@npm:^1.1.0, mri@npm:^1.2.0":
version: 1.2.0
resolution: "mri@npm:1.2.0"
checksum: 10/6775a1d2228bb9d191ead4efc220bd6be64f943ad3afd4dcb3b3ac8fc7b87034443f666e38805df38e8d047b29f910c3cc7810da0109af83e42c82c73bd3f6bc
Expand Down Expand Up @@ -20856,19 +20841,6 @@ __metadata:
languageName: node
linkType: hard

"multimatch@npm:^4.0.0":
version: 4.0.0
resolution: "multimatch@npm:4.0.0"
dependencies:
"@types/minimatch": "npm:^3.0.3"
array-differ: "npm:^3.0.0"
array-union: "npm:^2.1.0"
arrify: "npm:^2.0.1"
minimatch: "npm:^3.0.4"
checksum: 10/bdb6a98dad4e919d9a1a2a0db872f44fa2337315f2fd5827d91ae005cf22f4425782bdfa97c10b80d567f0cb3c226c31f4e85f8f6a4a4be4facf9af0de1bb0c2
languageName: node
linkType: hard

"mute-stream@npm:0.0.8":
version: 0.0.8
resolution: "mute-stream@npm:0.0.8"
Expand Down Expand Up @@ -22199,6 +22171,13 @@ __metadata:
languageName: node
linkType: hard

"picomatch@npm:^3.0.1":
version: 3.0.1
resolution: "picomatch@npm:3.0.1"
checksum: 10/65ac837fedbd0640586f7c214f6c7481e1e12f41cdcd22a95eb6a2914d1773707ed0f0b5bd2d1e39b5ec7860b43a4c9150152332a3884cd8dd1d419b2a2fa5b5
languageName: node
linkType: hard

"pify@npm:^2.3.0":
version: 2.3.0
resolution: "pify@npm:2.3.0"
Expand Down Expand Up @@ -23719,21 +23698,22 @@ __metadata:
languageName: node
linkType: hard

"pretty-quick@npm:^3.1.0":
version: 3.1.1
resolution: "pretty-quick@npm:3.1.1"
"pretty-quick@npm:^4.0.0":
version: 4.0.0
resolution: "pretty-quick@npm:4.0.0"
dependencies:
chalk: "npm:^3.0.0"
execa: "npm:^4.0.0"
find-up: "npm:^4.1.0"
ignore: "npm:^5.1.4"
mri: "npm:^1.1.5"
multimatch: "npm:^4.0.0"
execa: "npm:^5.1.1"
find-up: "npm:^5.0.0"
ignore: "npm:^5.3.0"
mri: "npm:^1.2.0"
picocolors: "npm:^1.0.0"
picomatch: "npm:^3.0.1"
tslib: "npm:^2.6.2"
peerDependencies:
prettier: ">=2.0.0"
prettier: ^3.0.0
bin:
pretty-quick: bin/pretty-quick.js
checksum: 10/28a64c9104aa74a9a259e4e8eee84169486342cf0b4d80aa230954b4676b79174bf74b14cac2f074e4e775465296c2632f3365506a1668aa20a0d96a39979512
pretty-quick: lib/cli.mjs
checksum: 10/df92a7ff9a485beb1d47d59c2a2ccb73f753e0133c59e99c56f3ded473fcf75b442fd9e4d53df13fd586c45bbc3e161531bd9d790f7d50f8d0b0a28fbd95c4a3
languageName: node
linkType: hard

Expand Down Expand Up @@ -24183,6 +24163,15 @@ __metadata:
languageName: node
linkType: hard

"react-icons@npm:^5.0.1":
version: 5.0.1
resolution: "react-icons@npm:5.0.1"
peerDependencies:
react: "*"
checksum: 10/c4458c643ae32a793ddebc5fa1235c7ec051be1b131205510e8199d15a4c89221a501f95a71fa21c2da93e8dd225290e2e24bb80abd3fb85801e43009e692098
languageName: node
linkType: hard

"react-is@npm:^16.13.1, react-is@npm:^16.6.0, react-is@npm:^16.7.0":
version: 16.13.1
resolution: "react-is@npm:16.13.1"
Expand Down

0 comments on commit b4727a5

Please sign in to comment.