rtk-querymsw

Freeze get query hooks progress at "pending"


And stop entire fetch work in "Loading.." like this screenshot.

==================================================================

enter image description here

==================================================================

RTK-Query setup is here.

import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'

import type { DocsList } from './types'

// Define a service using a base URL and expected endpoints
export const docsApi = createApi({
  baseQuery: fetchBaseQuery({ baseUrl: '' }),
  endpoints: (builder) => ({
    getDocsList: builder.query<DocsList, void>({
      query: () => `/docs_list`,
    }),
  }),
  reducerPath: 'docsApi',
})

// Export hooks for usage in functional components, which are
// auto-generated based on the defined endpoints
export const { useGetDocsListQuery } = docsApi

And this is whole codebase: https://github.com/laststance/vite-rtk-query

To reproduce, follow Install guide and you'll see the bug in a minute.


Solution

  • I tried npx msw init public then fix it.
    I certain this is ServiceWorker issue.enter image description here