ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAK
1
linkBug/FeatureCategorytitleLocation/Targetcommentscommentsmilestonenumberbody (Broken Import)labelsuserauthor_associationstatelockedcreated_atupdated_atpull_request
events_url
assigneeassigneesclosed_at
active_lock_reason
reactionstimeline_url
performed_via_github_app
state_reasondraft
4
https://github.com/reduxjs/redux-toolkit/issues/4106
FeatureRTKQrtk-query manual insert into cacheCache5
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
4106
API has an endpoint that provides a list of items that we need. E.g. we have a map application that shows a lot of structures for a specific scenario id. We then want to use deletion, updating, selecting the items by their respective ID. The way RTK Query builds the cache (key) is by the function name in combination with the (scenario) ID. If one of the items would change, it would invalidate the whole list.

## possible solutions:

1. A normalized cache, but https://redux-toolkit.js.org/rtk-query/usage/cache-behavior#no-normalized-or-de-duplicated-cache
2. onQueryStarted and using dispatch(api.util.upsertQueryData(...), but dispatch has quite the overhead and using it for more than a handful items slows down UI considerably
3. using the concept of a top-level-reducer that wraps the api reducer

## the makeshift solution for 3.
Creating a so-called top-level reducer in the root reducer that wraps the actual call to the list endpoint and creates fake actions to insert the list items one by one into the cache.

```typescript
export const rootReducer = {
[...]
// [structuredataApi.reducerPath]: structuredataApi.reducer,
[structuredataApi.reducerPath]: structuretlr,
[...]
};

function structuretlr(state: any, action: any) {
let newState: any = undefined;
let intermediateState = structuredataApi.reducer(state, action);
switch (action.type) {
//query is done
case 'structuredataApi/executeQuery/fulfilled': {
//list endpoint (get all structures by scenario)
if ('getStructuredataByScenarioId' == action.meta.arg.endpointName) {
//const startTime = performance.now();

let previousState: any = undefined;
action.payload.forEach((element: { id: any }) => {
const entryToAdd = [element];
const idToAdd = element.id;
//this is necessary as otherwise the fulfilled action won't insert
let fakePendingAction = {
type: 'structuredataApi/executeQuery/pending',
payload: undefined,
meta: {
...action.meta,
requestStatus: 'pending',
//not sure if this is necessary
requestId: action.meta.requestId + '_1',
arg: {
...action.meta.arg,
requestStatus: 'pending',
endpointName: `getStructuredataById`,
queryCacheKey: `getStructuredataById(${idToAdd})`,
originalArgs: idToAdd
}
}
};
//verbosity for debugging
let stateToSet = previousState ?? intermediateState;
previousState = structuredataApi.reducer(stateToSet, fakePendingAction);

let fakeFullfilledAction = {
...action,
payload: entryToAdd,
meta: {
...action.meta,
requestId: action.meta.requestId + '_1',
// requestId: action.meta.requestId,
arg: {
...action.meta.arg,
endpointName: `getStructuredataById`,
queryCacheKey: `getStructuredataById(${idToAdd})`,
originalArgs: idToAdd
}
}
};
previousState = structuredataApi.reducer(previousState, fakeFullfilledAction);
});
//const endTime = performance.now();
//const duration = endTime - startTime;
//console.log('inserting ' + action.payload.length + ' took ' + duration + ' ms');
newState = previousState;
}
break;
}
}
if (newState === undefined) {
newState = intermediateState;
}
return newState;
}
```

### small benchmarks to show the difference between dispatching and insertion via root-reducer:
dispatching 381 took 1130.2000000001863 ms
dispatching 991 took 6271.9000000003725 ms (note that dispatching here crashes the browser anyway)

inserting 381 took 247.5 ms
inserting 991 took 1593.7000000001863 ms

Doing inserts like this for more than 1000 items is not viable that way as it significantly affects user experience. So for now I guess we'll chunk the requests to 1000 at a time. I'm still in the experimentation phase with the solution above, but I do have some ideas to improve the solution here but for now it should work.


Big thanks to @markerikson for help and support!
[{"id":3064739336,"node_id":"MDU6TGFiZWwzMDY0NzM5MzM2","url":"https://api.github.com/repos/reduxjs/redux-toolkit/labels/rtk-query","name":"rtk-query","color":"33DA90","default":false,"description":""}]
{"login":"sebastian-dor","id":36453542,"node_id":"MDQ6VXNlcjM2NDUzNTQy","avatar_url":"https://avatars.githubusercontent.com/u/36453542?v=4","gravatar_id":"","url":"https://api.github.com/users/sebastian-dor","html_url":"https://github.com/sebastian-dor","followers_url":"https://api.github.com/users/sebastian-dor/followers","following_url":"https://api.github.com/users/sebastian-dor/following{/other_user}","gists_url":"https://api.github.com/users/sebastian-dor/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastian-dor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastian-dor/subscriptions","organizations_url":"https://api.github.com/users/sebastian-dor/orgs","repos_url":"https://api.github.com/users/sebastian-dor/repos","events_url":"https://api.github.com/users/sebastian-dor/events{/privacy}","received_events_url":"https://api.github.com/users/sebastian-dor/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-21T16:57:15Z
2024-01-22T08:41:25Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4106/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4106/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4106/timeline
6
https://github.com/reduxjs/redux-toolkit/issues/4100
QuestionRTKQAuthorization: Retry rejected actionRetry14100
I've created a custom middleware to verify if a some endpoint call was rejected. In case the action was rejected due to 401 status (unauthorized), I dispatch the update token endpoint and update the browser's local storage. This functionality is working well; however, I would like to retry the rejected action. How can I achieve this? Is there a more optimal approach for handling this scenario?


`store logic`
```javascript
export const store = configureStore({
reducer: reducers,
middleware: (getDefaultMiddleware) => getDefaultMiddleware()
.concat(authApi.middleware)
.concat(apiSlice.middleware)
.concat(refreshTokenMiddleware), // MY CUSTOM MIDDLEWARE
});
```

`middleware logic`
```javascript
export const refreshTokenMiddleware = (api) => (next) => async (action) => {
if (isRejected(action)) {
if (action?.payload?.status === 401) {
try {
const refreshToken = CredentialsHelper.refreshToken();

const {data} = await api.dispatch(
authApi.endpoints.refreshToken.initiate(refreshToken),
);


CredentialsHelper.update(data.access_token, data.refresh_token); // UPDATE THE BROWSER LOCAL STORAGE

api.dispatch(setCredentials({
token: data.access_token,
refreshToken: data.refresh_token,
}));

// where I would like to retry the rejected action

} catch (error) {
api.dispatch(logout());
api.dispatch(apiSlice.util.resetApiState());
}
}
}

return next(action);
};

```
[]
{"login":"gusazevedo","id":26143209,"node_id":"MDQ6VXNlcjI2MTQzMjA5","avatar_url":"https://avatars.githubusercontent.com/u/26143209?v=4","gravatar_id":"","url":"https://api.github.com/users/gusazevedo","html_url":"https://github.com/gusazevedo","followers_url":"https://api.github.com/users/gusazevedo/followers","following_url":"https://api.github.com/users/gusazevedo/following{/other_user}","gists_url":"https://api.github.com/users/gusazevedo/gists{/gist_id}","starred_url":"https://api.github.com/users/gusazevedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gusazevedo/subscriptions","organizations_url":"https://api.github.com/users/gusazevedo/orgs","repos_url":"https://api.github.com/users/gusazevedo/repos","events_url":"https://api.github.com/users/gusazevedo/events{/privacy}","received_events_url":"https://api.github.com/users/gusazevedo/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-19T21:05:48Z
2024-01-19T21:40:36Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4100/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4100/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4100/timeline
7
https://github.com/reduxjs/redux-toolkit/issues/4099
BugRTKQ-Code-GenIncorrect `*Read` interface used in circular dependencyoazapfts or imports14099
Hello,
first of all thanks for the amazing tool!

My team has found an issue in the new `ReadOnly/WriteOnly` support when having circular dependencies in the API specs.
I was able to replicate the issue with this simple OpenAPI spec:

```yaml
openapi: 3.0.2
info:
title: Test
version: 1.0.0
paths:
/foo:
get:
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/Foo'
/bar:
get:
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/Bar'
components:
schemas:
Bar:
type: object
required:
- id
properties:
id:
type: string
readOnly: true
foo:
readOnly: true
$ref: '#/components/schemas/Foo'
Foo:
type: object
required:
- id
properties:
id:
type: string
readOnly: true
bar:
readOnly: true
$ref: '#/components/schemas/Bar'
```
and using this configuration
```js
const config = {
schemaFile: "./spec.yaml",
apiFile: "./api",
apiImport: "api",
outputFile: "./generated.ts",
exportName: "api",
};

module.exports = config;
```

After running `npx @rtk-query/codegen-openapi ./config.js` the generated code contains:
```ts
export type Bar = {
foo?: Foo;
};
export type BarRead = {
id: string;
foo?: Foo; // should be FooRead
};
export type Foo = {
bar?: Bar;
};
export type FooRead = {
id: string;
bar?: BarRead; // correct reference
};
```

The interesting thing I noticed is that if you "flip" the `paths` in the OpenAPI spec so that
```yaml
paths:
/bar: ...
/foo: ...
```
the generated code changes to:
```ts
export type Foo = {
bar?: Bar;
};
export type FooRead = {
id: string;
bar?: Bar; // should be BarRead
};
export type Bar = {
foo?: Foo;
};
export type BarRead = {
id: string;
foo?: FooRead; // is now correct
};
```

Running
```shell
$ npx @rtk-query/codegen-openapi --version
1.2.0
```

Hope this helps investigate the issue and I'd be happy to contribute (but I am not familiar with the codebase) or validate possible fixes.

Thanks
[]
{"login":"teone","id":3929466,"node_id":"MDQ6VXNlcjM5Mjk0NjY=","avatar_url":"https://avatars.githubusercontent.com/u/3929466?v=4","gravatar_id":"","url":"https://api.github.com/users/teone","html_url":"https://github.com/teone","followers_url":"https://api.github.com/users/teone/followers","following_url":"https://api.github.com/users/teone/following{/other_user}","gists_url":"https://api.github.com/users/teone/gists{/gist_id}","starred_url":"https://api.github.com/users/teone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teone/subscriptions","organizations_url":"https://api.github.com/users/teone/orgs","repos_url":"https://api.github.com/users/teone/repos","events_url":"https://api.github.com/users/teone/events{/privacy}","received_events_url":"https://api.github.com/users/teone/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-19T18:16:26Z
2024-01-19T18:18:44Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4099/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4099/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4099/timeline
11
https://github.com/reduxjs/redux-toolkit/issues/4089
FeatureRTKQ[RTK Query] Pending queries abortedabort pending queryHe closed it after posting a workaround here44089
Hi,
I'm using RTK Query on a desktop application , you can think like Electron project. Anyway, when the query was started, backend creates new thread and it puts this thread into thread pool. Thread starting is pending status for me and I hava a lot of queries and threads in parallel. I am able to have one more thread in thread pool. And when I got a error, backend releases thread pool. This meaning, threads go to space and status of this pending won't change never.
Thus, I need to abort in pending queries if I got a error from any query. I didnt find anything about it.
[]
{"login":"atillaaliyev","id":6121871,"node_id":"MDQ6VXNlcjYxMjE4NzE=","avatar_url":"https://avatars.githubusercontent.com/u/6121871?v=4","gravatar_id":"","url":"https://api.github.com/users/atillaaliyev","html_url":"https://github.com/atillaaliyev","followers_url":"https://api.github.com/users/atillaaliyev/followers","following_url":"https://api.github.com/users/atillaaliyev/following{/other_user}","gists_url":"https://api.github.com/users/atillaaliyev/gists{/gist_id}","starred_url":"https://api.github.com/users/atillaaliyev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atillaaliyev/subscriptions","organizations_url":"https://api.github.com/users/atillaaliyev/orgs","repos_url":"https://api.github.com/users/atillaaliyev/repos","events_url":"https://api.github.com/users/atillaaliyev/events{/privacy}","received_events_url":"https://api.github.com/users/atillaaliyev/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-17T22:42:24Z
2024-01-18T12:12:41Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4089/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4089/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4089/timeline
12
https://github.com/reduxjs/redux-toolkit/issues/4088
Feature, QuestionRTKQValidate my approach of calling multiple queries chaining queries / queryFnquestion chain involving lenz44088
Hi,
I am working on the Sankey Graph widget. I have to grab data from a few different endpoints and then transform that data for the widget to consume.

I wanted to chain or call multiple queries together without putting the multiple useQuery calls in my component. In the past, I have been using multiple useQuery calls to chain query responses. While I am not against the approach it made my component needlessly complex.

This time around I am using the `queryFn` function along with calling the queries manually. Here is what my code looks like. Please ignore any mistakes in the code I just wanted to throw the idea out there and ask for feedback

```
const sankeyGrpah = apiSlice.injectEndpoints({
endpoints: (builder) => ({
getSankeyGraph: builder.query({
async queryFn(args, queryApi, extraOptions, baseQuery){
const sankeyGraphQuery = queryApi.dispatch(sankeyApi.endpoints.getSankeyGraphBase.initiate(arg));
const { unsubscribe: unsubscribeFromSankeyGraphQuery } =
sankeyGraphQuery;
const { data } = await sankeyGraphQuery;

if(data){
const nodesDataQuery = queryApi.dispatch(nodesApi.endpoints.getNodesData.initiate(data.ids));
const linksDataQuery = queryApi.dispatch(linksApi.endpoints.getLinksData.initiate(data.ids));

const {unsubscribe: unsubscribeFromNodesDataQuery} = nodesDataQuery;
const {unsubscribe: unsubscribeFromLinksDataQuery} = linksDataQuery
const nodesData = await nodesDataQuery;
const linksData = await linksDataQuery
///rest of transformation logic


unsubscribeFromNodesDataQuery()
unsubscribeFromLinksDataQuery()
// return data in queryFn format
}
}
})
})
})
```
[]
{"login":"nouman91","id":17067898,"node_id":"MDQ6VXNlcjE3MDY3ODk4","avatar_url":"https://avatars.githubusercontent.com/u/17067898?v=4","gravatar_id":"","url":"https://api.github.com/users/nouman91","html_url":"https://github.com/nouman91","followers_url":"https://api.github.com/users/nouman91/followers","following_url":"https://api.github.com/users/nouman91/following{/other_user}","gists_url":"https://api.github.com/users/nouman91/gists{/gist_id}","starred_url":"https://api.github.com/users/nouman91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nouman91/subscriptions","organizations_url":"https://api.github.com/users/nouman91/orgs","repos_url":"https://api.github.com/users/nouman91/repos","events_url":"https://api.github.com/users/nouman91/events{/privacy}","received_events_url":"https://api.github.com/users/nouman91/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-17T22:17:33Z
2024-01-18T16:11:21Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4088/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4088/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4088/timeline
13
https://github.com/reduxjs/redux-toolkit/issues/4079
FeatureRTKQ`retry` is not working as expectedGraphQLBaseQuery, Retrycommon theme of GraphQLBaseQuery issues, this time involving Retry84079
Hello,

I think the `retry` function exported from the rtk query package has not been working as expected for a while. I was able to trace back to a [specific commit](https://github.com/reduxjs/redux-toolkit/commit/0f62792fa0477eab0c3bc47a45c442205df7a997#commitcomment-137035837)

To reproduce
- wrap base query with `retry`
- chrome network tab, throttle option set to "offline"
- trigger a query in the app by clicking a button or something

Expected
- query throws something like `TypeError: network request failed`
- query is retried 5 times (default `maxRetries` value)
- after 5 unsuccessful retries, no more requests are made and my code receives the TypeError

Actual
- requests are retried indefinitely
[]
{"login":"eloiqs","id":7883515,"node_id":"MDQ6VXNlcjc4ODM1MTU=","avatar_url":"https://avatars.githubusercontent.com/u/7883515?v=4","gravatar_id":"","url":"https://api.github.com/users/eloiqs","html_url":"https://github.com/eloiqs","followers_url":"https://api.github.com/users/eloiqs/followers","following_url":"https://api.github.com/users/eloiqs/following{/other_user}","gists_url":"https://api.github.com/users/eloiqs/gists{/gist_id}","starred_url":"https://api.github.com/users/eloiqs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eloiqs/subscriptions","organizations_url":"https://api.github.com/users/eloiqs/orgs","repos_url":"https://api.github.com/users/eloiqs/repos","events_url":"https://api.github.com/users/eloiqs/events{/privacy}","received_events_url":"https://api.github.com/users/eloiqs/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-14T20:32:01Z
2024-01-21T23:32:56Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4079/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4079/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4079/timeline
15
https://github.com/reduxjs/redux-toolkit/issues/4074
Feature, Discussion
TS, Docs, RTKQDocumentation for the parameters passed to `providesTags` and `invalidatesTags` could be improvedprovidesTags invalidatesTagsclosable?24074
The only reference to the parameters passed when using a function for `providesTags`/`invalidatesTags` is in the endpoint definition type described in the docs [here](https://redux-toolkit.js.org/rtk-query/api/createApi#endpoints) ([repo link](https://github.com/reduxjs/redux-toolkit/blob/master/docs/rtk-query/api/createApi.mdx#L179))

```
providesTags?: ResultDescription<
TagTypes,
ResultType,
QueryArg,
BaseQueryError<BaseQuery>
>
```

But the typedef for `ResultDescription` is not present anywhere in the docs. Of course I can find it [in the repo](https://github.com/reduxjs/redux-toolkit/blob/master/packages/toolkit/src/query/endpointDefinitions.ts#L223), but it has a few levels of type nesting so I think it would be nice to have it presented in the docs as a function like this:

`providesTags: (result, error, arg, meta) => ...`

I am happy to open a PR, but I wanted to get thoughts from experienced contributors on what would be the best way to present this info. My first thought was to show an example which uses all available params in the [providesTags section of the createApi page](https://github.com/reduxjs/redux-toolkit/blob/master/docs/rtk-query/api/createApi.mdx#L487)

Edit: I think this could equally apply to some of the other functions that are part of an endpoint definition
[]
{"login":"gillycheesesteak","id":5541424,"node_id":"MDQ6VXNlcjU1NDE0MjQ=","avatar_url":"https://avatars.githubusercontent.com/u/5541424?v=4","gravatar_id":"","url":"https://api.github.com/users/gillycheesesteak","html_url":"https://github.com/gillycheesesteak","followers_url":"https://api.github.com/users/gillycheesesteak/followers","following_url":"https://api.github.com/users/gillycheesesteak/following{/other_user}","gists_url":"https://api.github.com/users/gillycheesesteak/gists{/gist_id}","starred_url":"https://api.github.com/users/gillycheesesteak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gillycheesesteak/subscriptions","organizations_url":"https://api.github.com/users/gillycheesesteak/orgs","repos_url":"https://api.github.com/users/gillycheesesteak/repos","events_url":"https://api.github.com/users/gillycheesesteak/events{/privacy}","received_events_url":"https://api.github.com/users/gillycheesesteak/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-13T02:33:37Z
2024-01-13T10:21:31Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4074/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4074/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4074/timeline
16
https://github.com/reduxjs/redux-toolkit/issues/4073
FeatureRTKQAutomatic normalization addon to rtk-querynormalization addon proposal04073
Hi, as discussed in https://github.com/reduxjs/redux-toolkit/issues/3248 , I integrated rtk-query with normy, a library, which allows automatic normalization and data updates for fetching libraries. There is already react-query and swr integration, now also rtk-query is supported. You can find it here - https://github.com/klis87/normy/tree/master/packages/normy-rtk-query#normyrtk-query

This is to solve problem mentioned here - https://redux-toolkit.js.org/rtk-query/comparison#no-normalized-or-deduplicated-cache and gives you apollo graphql like experience - relevant queries are automatically updated based on mutations results with no additional code.

I raised this issue not only as information, but also to mention several potential improvements, which could require some rtk-query changes
1) the integration is implemented as middleware, which also listens to rtk-query actions. is it possible to get those action types somehow? for now I wrote them by hand - https://github.com/klis87/normy/blob/master/packages/normy-rtk-query/src/index.ts#L22 , but ofc it would be much better to reuse rtk-query types
2) I could not manage to find a way to pass some meta attribute from query definition - like this - https://github.com/klis87/normy/blob/master/examples/rtk-query/src/api.js#L9 to the action here https://github.com/klis87/normy/blob/master/packages/normy-rtk-query/src/index.ts#L135 . This is problematic because without it I cannot allow an easy way to disable normalizations per specific queries and mutations. I added only global way as `normalizeQuery` and `normalizeMutation` options, but it is global, collocation style inside specific queries and mutations would be much better, like implemented in react-query addon - https://github.com/klis87/normy/tree/master/packages/normy-react-query#disabling-of-normalization-per-query-and-mutation-arrow_up
3) This library uses structural sharing, so if it works like I think, after each refetch it is checked that `data` is different. it would be cool to have this information in actions, so that middleware could give up normalization for a refetch which did not update data, which is a waste as it will end up with normalization store exactly the same as it was. This would be very nice optimization, especially that rtk-query has features like refetch on refocus, which potentially could cause multiple refetches at the same time.
[]
{"login":"klis87","id":11601850,"node_id":"MDQ6VXNlcjExNjAxODUw","avatar_url":"https://avatars.githubusercontent.com/u/11601850?v=4","gravatar_id":"","url":"https://api.github.com/users/klis87","html_url":"https://github.com/klis87","followers_url":"https://api.github.com/users/klis87/followers","following_url":"https://api.github.com/users/klis87/following{/other_user}","gists_url":"https://api.github.com/users/klis87/gists{/gist_id}","starred_url":"https://api.github.com/users/klis87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klis87/subscriptions","organizations_url":"https://api.github.com/users/klis87/orgs","repos_url":"https://api.github.com/users/klis87/repos","events_url":"https://api.github.com/users/klis87/events{/privacy}","received_events_url":"https://api.github.com/users/klis87/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-12T23:09:06Z
2024-01-12T23:09:06Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4073/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4073/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4073/timeline
17
https://github.com/reduxjs/redux-toolkit/issues/4067
FeatureRTKQ-Code-GenPerformance: rtk-query-codegen-openapi is slow when using multiple output filesPerformance04067
# Issue

My team and I are currently facing some performance issue when using [Multiple output files](https://redux-toolkit.js.org/rtk-query/usage/code-generation#multiple-output-files)
Our swagger.json has more than 70k lines and we generate 100+ ouput files in our client with `rtk-query-codegen-openapi`. This result in our script taking roughly 18sec to execute.

Our config file looks a bit like this:
```ts
import type { ConfigFile } from '@rtk-query/codegen-openapi'

const config: ConfigFile = {
schemaFile: '../server/swagger.json',
apiFile: './src/store/api/baseApi.ts',
apiImport: 'baseApi',
argSuffix: 'Args',
hooks: true,
responseSuffix: 'Response',
outputFiles: {
'./src/store/api/gen/agents.ts': {
filterEndpoints: [/agentsController/],
},
'./src/store/api/gen/tenants.ts': {
filterEndpoints: [/tenantsController/],
},
// 100+ more ...
},
}

export default config
```

# Explanation

When running [rtk-query-codegen-openapi](https://github.com/reduxjs/redux-toolkit/blob/master/packages/rtk-query-codegen-openapi/src/bin/cli.ts), [parseConfig](https://github.com/reduxjs/redux-toolkit/blob/master/packages/rtk-query-codegen-openapi/src/index.ts#L26) will generate a list of config for each outputFile, triggering `generateApi` for each of them.
However, the current logic parse the `spec` (path of our swagger.json) at each execution of [generateApi](https://github.com/reduxjs/redux-toolkit/blob/master/packages/rtk-query-codegen-openapi/src/generate.ts#L100C3-L100C38):
```ts
const v3Doc = await getV3Doc(spec);
```
This process takes a bit of time as you may expect, and becomes slower as our outputFiles grows

# Current fix (patch)

I'm currently applying a patch on the file to cache the output of `getV3Doc` as follow:
```diff
diff --git a/node_modules/@rtk-query/codegen-openapi/lib/generate.js b/node_modules/@rtk-query/codegen-openapi/lib/generate.js
index bfcfed7..7e11f13 100644
--- a/node_modules/@rtk-query/codegen-openapi/lib/generate.js
+++ b/node_modules/@rtk-query/codegen-openapi/lib/generate.js
@@ -61,8 +61,11 @@ function getOverrides(operation, endpointOverrides) {
return endpointOverrides === null || endpointOverrides === void 0 ? void 0 : endpointOverrides.find((override) => operationMatches(override.pattern)(operation));
}
exports.getOverrides = getOverrides;
+
+const cache = {}
async function generateApi(spec, { apiFile, apiImport = 'api', exportName = 'enhancedApi', argSuffix = 'ApiArg', responseSuffix = 'ApiResponse', hooks = false, outputFile, isDataResponse = defaultIsDataResponse, filterEndpoints, endpointOverrides, }) {
- const v3Doc = await (0, utils_1.getV3Doc)(spec);
+ cache[spec] = cache[spec] || await (0, utils_1.getV3Doc)(spec)
+ const v3Doc = cache[spec]
const apiGen = new generate_1.default(v3Doc, {});
const operationDefinitions = (0, utils_1.getOperationDefinitions)(v3Doc).filter(operationMatches(filterEndpoints));
const resultFile = typescript_1.default.createSourceFile('someFileName.ts', '', typescript_1.default.ScriptTarget.Latest,
```

This helped to cut the running time from 18 seconds to only 2 seconds without modifying our structure

# Alternative approach

## Single ouput file

We tried this approach already, but it creates some issues with typescript as you may expect due to the amount of information extracted in a single type.
`Type instantiation is excessively deep and possibly infinite.`

<img width="532" alt="image" src="https://github.com/reduxjs/redux-toolkit/assets/1822058/f4ade9ab-897c-4d57-9b27-e0ed9e018449">


## Multiple swagger files

Instead of generating a single swagger file, the other idea was to generate a swagger for each controller in our backend and run `rtk-query-codegen-openapi` on each one of them.
This is a more tedious task, but it should reduce it as the amount of information to parse would become small for each swagger files. However, this is not an ideal solution for us.


# Action

If it is okay, I will prepare a PR to add the current fix to `rtk-query-codegen-openapi`
[]
{"login":"d-mon-","id":1822058,"node_id":"MDQ6VXNlcjE4MjIwNTg=","avatar_url":"https://avatars.githubusercontent.com/u/1822058?v=4","gravatar_id":"","url":"https://api.github.com/users/d-mon-","html_url":"https://github.com/d-mon-","followers_url":"https://api.github.com/users/d-mon-/followers","following_url":"https://api.github.com/users/d-mon-/following{/other_user}","gists_url":"https://api.github.com/users/d-mon-/gists{/gist_id}","starred_url":"https://api.github.com/users/d-mon-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d-mon-/subscriptions","organizations_url":"https://api.github.com/users/d-mon-/orgs","repos_url":"https://api.github.com/users/d-mon-/repos","events_url":"https://api.github.com/users/d-mon-/events{/privacy}","received_events_url":"https://api.github.com/users/d-mon-/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-12T06:52:17Z
2024-01-12T06:52:17Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4067/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4067/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4067/timeline
20
https://github.com/reduxjs/redux-toolkit/issues/4058
Feature, QuestionRTKQ-Code-GenQuestion/Feature (@rtk-query/codegen-openapi): Support for overriding path-level parameters at operation Levelparams04058
Hey.
I was trying to set up my query client with the auto generator and noticed that the generated `ApiArg` types are not following the OpenAPI specs for overriding path-level parameters. At least not how I would expect them to.

From the OpenAPI specs on operation object parameters: https://spec.openapis.org/oas/latest.html#operation-object
> A list of parameters that are applicable for this operation. **If a parameter is already defined at the [Path Item](https://spec.openapis.org/oas/latest.html#pathItemParameters), the new definition will override it but can never remove it.**

An OpenAPI spec example of this from https://swagger.io/docs/specification/describing-parameters/
```yaml
paths:
/users/{id}:
parameters:
- in: path
name: id
type: integer
required: true
description: The user ID.

# DELETE /users/{id} - uses a single ID.
# Reuses the {id} parameter definition from the path level.
delete:
summary: Deletes the user with the specified ID.
responses:
'204':
description: User was deleted.
# GET /users/id1,id2,id3 - uses one or more user IDs.
# Overrides the path-level {id} parameter.
get:
summary: Gets one or more users by ID.
parameters:
- in: path
name: id
required: true
description: A comma-separated list of user IDs.
type: array
items:
type: integer
minItems: 1
responses:
'200':
description: OK
```

Which results in the generated `ApiArgs`
```typescript
export type DeleteUsersByIdApiArg = {
/** The user ID. */
id: number;
};
export type GetUsersByIdApiArg = {
/** The user ID. */
pathId: number;
/** A comma-separated list of user IDs. */
_pathId: number[];
};
```

It looks good when not overriding the path-level parameter, but overriding the parameter at operation-level, the generated `id` path-level parameter is now present twice - as both types.
Both of these different parameters then has to be provided in the hooks, which seems odd and makes the querying quite confusing. Is this intended?
![image](https://github.com/reduxjs/redux-toolkit/assets/109796353/8d25474c-02fa-438f-ba41-f384f9d5b67c)

I would expect the generated `ApiArgs` to match those of the OpenAPI specs and only require the overriding parameter. Like we see in the swagger UI, only requiring operation-level parameter.
![image](https://github.com/reduxjs/redux-toolkit/assets/109796353/d12ce0e5-7cc1-4cb8-b0f8-123f5a4f13fa)

Any clarification would be appreciated, thanks.

[]
{"login":"tricent-lvi","id":109796353,"node_id":"U_kgDOBotcAQ","avatar_url":"https://avatars.githubusercontent.com/u/109796353?v=4","gravatar_id":"","url":"https://api.github.com/users/tricent-lvi","html_url":"https://github.com/tricent-lvi","followers_url":"https://api.github.com/users/tricent-lvi/followers","following_url":"https://api.github.com/users/tricent-lvi/following{/other_user}","gists_url":"https://api.github.com/users/tricent-lvi/gists{/gist_id}","starred_url":"https://api.github.com/users/tricent-lvi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tricent-lvi/subscriptions","organizations_url":"https://api.github.com/users/tricent-lvi/orgs","repos_url":"https://api.github.com/users/tricent-lvi/repos","events_url":"https://api.github.com/users/tricent-lvi/events{/privacy}","received_events_url":"https://api.github.com/users/tricent-lvi/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-10T09:01:18Z
2024-01-10T09:01:18Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4058/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4058/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4058/timeline
21
https://github.com/reduxjs/redux-toolkit/issues/4057
FeatureRTKQHandling Dynamic Endpoint Arguments for Cache UpdatesCache (evaluation) - passing args to updateQueryData14057
I'm attempting to update cache data from an endpoint, but I'm encountering a challenge with dynamic endpoint parameters. These parameters can vary due to pagination, making it difficult to pass them consistently.

I've tried to invalidate the cache using `invalidatesTags` and `providesTags` only. However, it seems that the backend does not process the result fast enough to update the frontend data upon refetch.

```javascript
endpoints: (builder) => ({
listAllUsers: builder.query({
query: ({
page = 0,
page_size = 15,
order = 'nickname',
order_mode = 'asc',
search = undefined,
}) => ({
url: '/admin/admins',
method: 'GET',
params: {page, page_size, order, order_mode, search},
}),
}),
createUser: builder.mutation({
query: (data) => ({
url: '/admin/new',
method: 'POST',
body: {
nickname: data.name,
email: data.email,
password: data.password,
password_mode: 'permanent',
},
}),
async onQueryStarted(props, {queryFulfilled, dispatch}) {
const {data: newUser} = await queryFulfilled;
const patchCollection = dispatch(
apiSlice.util.updateQueryData('listAllUsers', {
page: 0, // this prop should be dynamic
page_size: 15, // this prop should be dynamic
}, (draft) => {
draft.users.splice(0, 0, {...newUser.admin, nickname: newUser.admin.name});
}),
);

queryFulfilled.catch(patchCollection.undo);
},
}),
})
```

## Explanation
Cache invalidation isn't working as expected because I'm required to pass the exact endpoint arguments from the 'listAllUsers' route to the updateQueryData function

### Query on table component
```javascript
const {data, isLoading} = useListAllUsersQuery({
page,
page_size: rowsPerPage,
search: searchParam,
// others...
}, {
refetchOnMountOrArgChange: true,
});
```

## Goal
Be able to retrieve the args from some endpoint (`listAllUsers`) and pass to the `updateQueryData` function
```javascript
const endpointArgs = someGetArgsFunction();

const patchCollection = dispatch(
apiSlice.util.updateQueryData('listAllUsers', {
endpointArgs
}, (draft) => {
draft.users.splice(0, 0, {...newUser.admin, nickname: newUser.admin.name});
}),
);
```
[]
{"login":"gusazevedo","id":26143209,"node_id":"MDQ6VXNlcjI2MTQzMjA5","avatar_url":"https://avatars.githubusercontent.com/u/26143209?v=4","gravatar_id":"","url":"https://api.github.com/users/gusazevedo","html_url":"https://github.com/gusazevedo","followers_url":"https://api.github.com/users/gusazevedo/followers","following_url":"https://api.github.com/users/gusazevedo/following{/other_user}","gists_url":"https://api.github.com/users/gusazevedo/gists{/gist_id}","starred_url":"https://api.github.com/users/gusazevedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gusazevedo/subscriptions","organizations_url":"https://api.github.com/users/gusazevedo/orgs","repos_url":"https://api.github.com/users/gusazevedo/repos","events_url":"https://api.github.com/users/gusazevedo/events{/privacy}","received_events_url":"https://api.github.com/users/gusazevedo/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-10T06:17:52Z
2024-01-12T12:24:30Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4057/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4057/reactions","total_count":4,"+1":4,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4057/timeline
23
https://github.com/reduxjs/redux-toolkit/issues/4051
Bug, QuestionRTKQHelp Wanted: Related to baseQuery and baseURLbaseQuery (cookie/credentials)I think unrelated to RTKQ24051
I am having a setup where I use a jwt and http only cookie for auth in a MERN stack website.

In the frontend's API slice, I am using the following:
`const baseQuery = fetchBaseQuery({ baseUrl: 'http://localhost:3000' });`
where `http://localhost:3000` is my backend server's address.

When I use the above configuration, the request sent to backend server does not include the jwt auth cookie.

But when I use vite's proxy to handle connections to `http://localhost:3000`, everything seems to work normally and the request also has the jwt cookie in it.

I can't seem to get why this is happening
[]
{"login":"Pranav-Talmale","id":67180305,"node_id":"MDQ6VXNlcjY3MTgwMzA1","avatar_url":"https://avatars.githubusercontent.com/u/67180305?v=4","gravatar_id":"","url":"https://api.github.com/users/Pranav-Talmale","html_url":"https://github.com/Pranav-Talmale","followers_url":"https://api.github.com/users/Pranav-Talmale/followers","following_url":"https://api.github.com/users/Pranav-Talmale/following{/other_user}","gists_url":"https://api.github.com/users/Pranav-Talmale/gists{/gist_id}","starred_url":"https://api.github.com/users/Pranav-Talmale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pranav-Talmale/subscriptions","organizations_url":"https://api.github.com/users/Pranav-Talmale/orgs","repos_url":"https://api.github.com/users/Pranav-Talmale/repos","events_url":"https://api.github.com/users/Pranav-Talmale/events{/privacy}","received_events_url":"https://api.github.com/users/Pranav-Talmale/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-07T14:21:09Z
2024-01-11T01:26:54Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4051/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4051/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4051/timeline
25
https://github.com/reduxjs/redux-toolkit/issues/4044
Feature, QuestionRTKQ[QUESTION / FEATURE] Handle parameter serialisation according to `collectionFormat`collectionFormat handling - param serialization04044
Hey,

I would like to know if RTK-Query handles the `collectionFormat` value described in the parameter swagger docs https://swagger.io/docs/specification/2-0/describing-parameters/

From what I have seen with RTKQ, array parameters are always serialised using the `CSV format`, but maybe I missed something.

Thanks.
[]
{"login":"julien-tricent","id":143804540,"node_id":"U_kgDOCJJIfA","avatar_url":"https://avatars.githubusercontent.com/u/143804540?v=4","gravatar_id":"","url":"https://api.github.com/users/julien-tricent","html_url":"https://github.com/julien-tricent","followers_url":"https://api.github.com/users/julien-tricent/followers","following_url":"https://api.github.com/users/julien-tricent/following{/other_user}","gists_url":"https://api.github.com/users/julien-tricent/gists{/gist_id}","starred_url":"https://api.github.com/users/julien-tricent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julien-tricent/subscriptions","organizations_url":"https://api.github.com/users/julien-tricent/orgs","repos_url":"https://api.github.com/users/julien-tricent/repos","events_url":"https://api.github.com/users/julien-tricent/events{/privacy}","received_events_url":"https://api.github.com/users/julien-tricent/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-05T10:42:55Z
2024-01-05T10:43:27Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4044/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4044/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4044/timeline
27
https://github.com/reduxjs/redux-toolkit/issues/4038
BugRTKQ-Code-Genrtk-query-codegen-openapi has outdated prettier 2.x peer dependencyPrettierOpen PR64038
Prettier 3 has been out for half a year, it is probably time to update, see https://prettier.io/blog/2023/07/05/3.0.0.html.

See also #3604
[]
{"login":"FabianFrank","id":691152,"node_id":"MDQ6VXNlcjY5MTE1Mg==","avatar_url":"https://avatars.githubusercontent.com/u/691152?v=4","gravatar_id":"","url":"https://api.github.com/users/FabianFrank","html_url":"https://github.com/FabianFrank","followers_url":"https://api.github.com/users/FabianFrank/followers","following_url":"https://api.github.com/users/FabianFrank/following{/other_user}","gists_url":"https://api.github.com/users/FabianFrank/gists{/gist_id}","starred_url":"https://api.github.com/users/FabianFrank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FabianFrank/subscriptions","organizations_url":"https://api.github.com/users/FabianFrank/orgs","repos_url":"https://api.github.com/users/FabianFrank/repos","events_url":"https://api.github.com/users/FabianFrank/events{/privacy}","received_events_url":"https://api.github.com/users/FabianFrank/received_events","type":"User","site_admin":false}
NONEopenFALSE
2024-01-04T19:15:27Z
2024-01-04T23:31:22Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4038/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4038/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4038/timeline
29
https://github.com/reduxjs/redux-toolkit/issues/4022
FeatureRTKQ[graphql-request-base-query] There aren't ability to get "extensions" inside query/queryFn/onQueryStartedGraphQLBaseQueryLenz assigned to himself - Another GraphQLBaseQuery issue24022
Problem: Ability to get response information (`GraphQLClientResponse`) has only in middleware layer.
Solution: Provide more information into `meta`

```
new GraphQLClient(url, {
responseMiddleware: response => {
console.log(response);
}
});
```

Current code:
https://github.com/reduxjs/redux-toolkit/blob/0d1f7101e83865714cb512c850bc53ffaee2d5e5/packages/rtk-query-graphql-request-base-query/src/index.ts#L42-L49

Suggestion:
```
const { query } = resolveRequestDocument(document);

const response = await client.rawRequest({
query,
variables,
signal,
requestHeaders: preparedHeaders
});

return {
data: response.data,
meta: {
baseQueryMeta: { response } // smth like this...
}
};
```
[]
{"login":"rewweRrr","id":8566173,"node_id":"MDQ6VXNlcjg1NjYxNzM=","avatar_url":"https://avatars.githubusercontent.com/u/8566173?v=4","gravatar_id":"","url":"https://api.github.com/users/rewweRrr","html_url":"https://github.com/rewweRrr","followers_url":"https://api.github.com/users/rewweRrr/followers","following_url":"https://api.github.com/users/rewweRrr/following{/other_user}","gists_url":"https://api.github.com/users/rewweRrr/gists{/gist_id}","starred_url":"https://api.github.com/users/rewweRrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rewweRrr/subscriptions","organizations_url":"https://api.github.com/users/rewweRrr/orgs","repos_url":"https://api.github.com/users/rewweRrr/repos","events_url":"https://api.github.com/users/rewweRrr/events{/privacy}","received_events_url":"https://api.github.com/users/rewweRrr/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-29T14:44:33Z
2024-01-05T07:29:33Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4022/events
{"login":"phryneas","id":4282439,"node_id":"MDQ6VXNlcjQyODI0Mzk=","avatar_url":"https://avatars.githubusercontent.com/u/4282439?v=4","gravatar_id":"","url":"https://api.github.com/users/phryneas","html_url":"https://github.com/phryneas","followers_url":"https://api.github.com/users/phryneas/followers","following_url":"https://api.github.com/users/phryneas/following{/other_user}","gists_url":"https://api.github.com/users/phryneas/gists{/gist_id}","starred_url":"https://api.github.com/users/phryneas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phryneas/subscriptions","organizations_url":"https://api.github.com/users/phryneas/orgs","repos_url":"https://api.github.com/users/phryneas/repos","events_url":"https://api.github.com/users/phryneas/events{/privacy}","received_events_url":"https://api.github.com/users/phryneas/received_events","type":"User","site_admin":false}
[{"login":"phryneas","id":4282439,"node_id":"MDQ6VXNlcjQyODI0Mzk=","avatar_url":"https://avatars.githubusercontent.com/u/4282439?v=4","gravatar_id":"","url":"https://api.github.com/users/phryneas","html_url":"https://github.com/phryneas","followers_url":"https://api.github.com/users/phryneas/followers","following_url":"https://api.github.com/users/phryneas/following{/other_user}","gists_url":"https://api.github.com/users/phryneas/gists{/gist_id}","starred_url":"https://api.github.com/users/phryneas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phryneas/subscriptions","organizations_url":"https://api.github.com/users/phryneas/orgs","repos_url":"https://api.github.com/users/phryneas/repos","events_url":"https://api.github.com/users/phryneas/events{/privacy}","received_events_url":"https://api.github.com/users/phryneas/received_events","type":"User","site_admin":false}]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4022/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4022/timeline
30
https://github.com/reduxjs/redux-toolkit/issues/4015
Bug, QuestionTS, RTKQ2.0 RTK Query Macro Error Handling middleware type error on the `payload`middleware type error in 2.0acemarke answered14015
I'm following the [docs](https://redux-toolkit.js.org/rtk-query/usage/error-handling#handling-errors-at-a-macro-level) in handling RTK Query error and while I got no type errors in versions prior to v2.0, now I'm getting type errors when trying to access the payload properties.

```
/** Handle error logging */
export const errorLogger: Middleware =
(api: MiddlewareAPI) => (next) => (action) => {
if (isRejectedWithValue(action)) {
// Handle errors based on their status codes
switch (action?.payload?.status) {
// If server has errors
case 500:
Toast.show({
type: "error",
text1: "Server Error",
text2: action?.payload?.data?.message,
});
break;

default:
Toast.show({
type: "error",
text1: "Error",
text2: action?.payload?.data?.message,
});
}
}

return next(action);
};
```

Type error for `action?.payload?.status`: `Property 'status' does not exist on type '{}'.`

I'm wondering why this didn't happen in versions prior to v2.0 and also how can I fix this?
[]
{"login":"n-ii-ma","id":88039431,"node_id":"MDQ6VXNlcjg4MDM5NDMx","avatar_url":"https://avatars.githubusercontent.com/u/88039431?v=4","gravatar_id":"","url":"https://api.github.com/users/n-ii-ma","html_url":"https://github.com/n-ii-ma","followers_url":"https://api.github.com/users/n-ii-ma/followers","following_url":"https://api.github.com/users/n-ii-ma/following{/other_user}","gists_url":"https://api.github.com/users/n-ii-ma/gists{/gist_id}","starred_url":"https://api.github.com/users/n-ii-ma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n-ii-ma/subscriptions","organizations_url":"https://api.github.com/users/n-ii-ma/orgs","repos_url":"https://api.github.com/users/n-ii-ma/repos","events_url":"https://api.github.com/users/n-ii-ma/events{/privacy}","received_events_url":"https://api.github.com/users/n-ii-ma/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-12-26T06:43:37Z
2023-12-26T07:40:40Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4015/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4015/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4015/timeline
31
https://github.com/reduxjs/redux-toolkit/issues/4009
BugRTKQ, 2.0resetApiState is not resetting the local state of the hookresetApiState - regression on local state (didn't fix in 2.1.0)has a sandbox for repro04009
On redux toolkit 1.9.2, resetApiState resets the hooks local state.
After upgrading to toolkit to 2.0.1 we found an issue in our app relating to resetApiState call is not resetting the local state of the hook

[Sandbox using toolkit 1.9.2](https://codesandbox.io/p/sandbox/priceless-poincare-cnctxs?file=%2Fpackage.json%3A12%2C26)
[Sandbox using toolkit 2.0.1](https://codesandbox.io/p/sandbox/unruffled-platform-6tjjht?file=%2Fpackage.json%3A7%2C29)

Reproduction steps:
- Click on login button
- In the next screen you should see
<img width="959" alt="image" src="https://github.com/reduxjs/redux-toolkit/assets/1705639/2b996d5a-4187-4a61-946b-14611b00a021">
- Click logout

Result in 1.9.2
<img width="590" alt="image" src="https://github.com/reduxjs/redux-toolkit/assets/1705639/2deadfa0-190e-4795-afd3-447fbc6ac4d0">

Result in 2.0.1 - this is a bug
<img width="972" alt="image" src="https://github.com/reduxjs/redux-toolkit/assets/1705639/0d315a77-431b-46f4-b2ac-39eebd5f6f6b">



[]
{"login":"saibs","id":1705639,"node_id":"MDQ6VXNlcjE3MDU2Mzk=","avatar_url":"https://avatars.githubusercontent.com/u/1705639?v=4","gravatar_id":"","url":"https://api.github.com/users/saibs","html_url":"https://github.com/saibs","followers_url":"https://api.github.com/users/saibs/followers","following_url":"https://api.github.com/users/saibs/following{/other_user}","gists_url":"https://api.github.com/users/saibs/gists{/gist_id}","starred_url":"https://api.github.com/users/saibs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saibs/subscriptions","organizations_url":"https://api.github.com/users/saibs/orgs","repos_url":"https://api.github.com/users/saibs/repos","events_url":"https://api.github.com/users/saibs/events{/privacy}","received_events_url":"https://api.github.com/users/saibs/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-22T15:30:20Z
2023-12-22T15:47:14Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4009/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4009/reactions","total_count":2,"+1":2,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4009/timeline
32
https://github.com/reduxjs/redux-toolkit/issues/4007
BugRTKQ-Code-Gen, TS@rtk-query/codegen-openapi fails with identifierToKeywordKind is not a function errorpeer dependancies - TS04007
When running @rtk-query/codegen-openapi, generation fails with the following error;

TypeError: typescript_1.default.identifierToKeywordKind is not a function
at Object.isValidIdentifier (C:\Projects\github\vesey\searchpoint4\node_modules\oazapfts\src\codegen\tscodegen.ts:523:8)
at getOperationIdentifier (C:\Projects\github\vesey\searchpoint4\node_modules\oazapfts\src\codegen\generate.ts:92:10)
at getOperationName (C:\Projects\github\vesey\searchpoint4\node_modules\oazapfts\src\codegen\generate.ts:104:14)
at getOperationName (C:\Projects\github\vesey\searchpoint4\node_modules\@rtk-query\codegen-openapi\src\generate.ts:34:27)
at generateEndpoint (C:\Projects\github\vesey\searchpoint4\node_modules\@rtk-query\codegen-openapi\src\generate.ts:217:27)
at C:\Projects\github\vesey\searchpoint4\node_modules\@rtk-query\codegen-openapi\src\generate.ts:152:15
at Array.map (<anonymous>)
at generateApi (C:\Projects\github\vesey\searchpoint4\node_modules\@rtk-query\codegen-openapi\src\generate.ts:151:34)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at generateEndpoints (C:\Projects\github\vesey\searchpoint4\node_modules\@rtk-query\codegen-openapi\src\index.ts:14:22)

This is a regression - it works (with deprecation warnings) on version 1.0.0, but not on any version since 1.1.0.
Version 1.1.0 and above uses oazapfts whereas 1.0.0 doesn't.

This is my understanding of it (I'm not an expert)...

@rtk-query/codegen-openapi version 1.1.0 and up has a dependency on oazapfts - version 4.12.0 is currently being installed which has a typescript dependency of ^5.2.2. However, @rtk-query/codegen-openapi also has a dependency on commander version ^6.2.0 which has a typescript dependency of ^4.0.3, causing typescript version 4.9.5 to be installed. Typescript 4.9.5 is being referenced by the tscodegen.ts file but doesn't have identifierToKeywordKind function.

Failing code is in isValidIdentifier, which dereferences ts.identifierToKeywordKind...

export function isValidIdentifier(str: string) {
if (!str.length || str.trim() !== str) return false;
const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest);
return (
!!node &&
node.kind === ts.SyntaxKind.Identifier &&
ts.identifierToKeywordKind(node) === undefined
);
}

The latest version of commander now uses typescript ^5.0.4 so could we(somebody) swap out the version of commander to resolve this issue?

Thanks

[]
{"login":"richyclarke","id":4125089,"node_id":"MDQ6VXNlcjQxMjUwODk=","avatar_url":"https://avatars.githubusercontent.com/u/4125089?v=4","gravatar_id":"","url":"https://api.github.com/users/richyclarke","html_url":"https://github.com/richyclarke","followers_url":"https://api.github.com/users/richyclarke/followers","following_url":"https://api.github.com/users/richyclarke/following{/other_user}","gists_url":"https://api.github.com/users/richyclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/richyclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richyclarke/subscriptions","organizations_url":"https://api.github.com/users/richyclarke/orgs","repos_url":"https://api.github.com/users/richyclarke/repos","events_url":"https://api.github.com/users/richyclarke/events{/privacy}","received_events_url":"https://api.github.com/users/richyclarke/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-21T20:53:30Z
2023-12-21T20:53:30Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4007/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4007/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4007/timeline
33
https://github.com/reduxjs/redux-toolkit/issues/4006
QuestionRTKQDelete cache entrycache invalidation (delete entries)ben + mark answered44006
Hello!
Is there a way to remove cache entries with the same name without being bound by arguments? I need to remove them, and not invalidate them.

For example these:
![image](https://github.com/reduxjs/redux-toolkit/assets/70245262/0c65e082-8b0e-4912-ae6f-90066513ef7e)

I have 2 lists with items and inside each item it is possible to see items from the second list. That is why it is important that when I make manipulations in one list, the actual data (sorting, deleting, changing) is displayed inside the item from the second list. I hope this doesn't sound like a complicated explanation.
Cache invalidation is not working correctly because on list 1 page I can't update a specific entry from list 2 because I don't know its ID. And this provokes unnecessary queries to the database during some actions.
[]
{"login":"YuriyDyachkov","id":70245262,"node_id":"MDQ6VXNlcjcwMjQ1MjYy","avatar_url":"https://avatars.githubusercontent.com/u/70245262?v=4","gravatar_id":"","url":"https://api.github.com/users/YuriyDyachkov","html_url":"https://github.com/YuriyDyachkov","followers_url":"https://api.github.com/users/YuriyDyachkov/followers","following_url":"https://api.github.com/users/YuriyDyachkov/following{/other_user}","gists_url":"https://api.github.com/users/YuriyDyachkov/gists{/gist_id}","starred_url":"https://api.github.com/users/YuriyDyachkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YuriyDyachkov/subscriptions","organizations_url":"https://api.github.com/users/YuriyDyachkov/orgs","repos_url":"https://api.github.com/users/YuriyDyachkov/repos","events_url":"https://api.github.com/users/YuriyDyachkov/events{/privacy}","received_events_url":"https://api.github.com/users/YuriyDyachkov/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-21T17:30:23Z
2023-12-21T18:09:47Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4006/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4006/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4006/timeline
34
https://github.com/reduxjs/redux-toolkit/issues/4002
BugRTKQ[RTK Query]: Problems with rerenders with useMemo createSelectoruseMemo createSelectorMerged PR - also has a workaround solution code14002
Hello and thank you for a brilliant library.
I'm using @reduxjs/toolkit 1.9.7
I'm struggling with two custom hooks with a useMemo createSelector. Both retrieve data from the same query. One only retrieves an object (which works) and the other retrieves an array (which doesn't work)

This is the hook that works
```javascript
const useGetSingelTagOPC = (tagname) => {


const selectdb = useMemo(() => {
const emptyObjekt = {};
return createSelector(
(res) => res.data,
(res, name) => name,
(data, name) => {
const filteredData = data?.filter((tag) => tag.name === name) ?? emptyObjekt;
return filteredData[0];
}
);
}, []);

const { opctag } = useGetTagsQuery(undefined, {
selectFromResult: (result) => {
// console.log(result);
return {
opctag: selectdb(result, tagname)
};
}
});

return { opctag };
};

export default useGetSingelTagOPC;
```

This is a hook that does not work and rerenders my component every time there is an update in `useGetTagsQuery`

```javascript

const useGetTagGroupOPC = (dbmame) => {
const selectTagsIndb = useMemo(() => {
const emptyArray = [];
return createSelector(
(res) => res.data,
(res, db) => db,
(data, db) => {
const filteredData = data?.filter((tag) => tag.db === db) ?? emptyArray;
return filteredData;
}
);
}, []);

const { opctags } = useGetTagsQuery(undefined, {
selectFromResult: (result) => {
return {
opctags: selectTagsIndb(result, dbmame)
};
}
});

return { opctags };
};

export default useGetTagGroupOPC;
```

Example of data from `useGetTagsQuery`

```javascript
const exsampleArray = [
{
id: 63,
name: 'FrontJobAGV2_DB_statusmaster_AGV_ACKtoOM',
db: 'FrontJobAGV2_DB',
value: false,
type: 1
},
{
id: 64,
name: 'FrontJobAGV2_DB_statusmaster_DelivPosOK',
db: 'FrontJobAGV2_DB',
value: true,
type: 1
},
{
id: 65,
name: 'FrontJobAGV2_DB_statusmaster_DelivPosNOK',
db: 'FrontJobAGV2_DB',
value: false,
type: 1
}
];


```

Need help here to understand what is wrong with `useGetTagGroupOPC`

In advance, thank you
[]
{"login":"KnutHelstad","id":48108928,"node_id":"MDQ6VXNlcjQ4MTA4OTI4","avatar_url":"https://avatars.githubusercontent.com/u/48108928?v=4","gravatar_id":"","url":"https://api.github.com/users/KnutHelstad","html_url":"https://github.com/KnutHelstad","followers_url":"https://api.github.com/users/KnutHelstad/followers","following_url":"https://api.github.com/users/KnutHelstad/following{/other_user}","gists_url":"https://api.github.com/users/KnutHelstad/gists{/gist_id}","starred_url":"https://api.github.com/users/KnutHelstad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KnutHelstad/subscriptions","organizations_url":"https://api.github.com/users/KnutHelstad/orgs","repos_url":"https://api.github.com/users/KnutHelstad/repos","events_url":"https://api.github.com/users/KnutHelstad/events{/privacy}","received_events_url":"https://api.github.com/users/KnutHelstad/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-20T10:27:56Z
2024-01-10T11:47:55Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4002/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/4002/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/4002/timeline
35
https://github.com/reduxjs/redux-toolkit/issues/3999
FeatureDocs, RTKQ[RTK Query]: Documentation for useQuery returned refetch value must be updated.refetchlinks to #1939 & Open PR03999
This change https://github.com/reduxjs/redux-toolkit/pull/2212 seems to not be reflected in the documentation.

The signature shows that the `refetch` function is returning `void` whereas it's actually returning `Promise<void>` since the aforementioned change.

![image](https://github.com/reduxjs/redux-toolkit/assets/17209506/27da3f26-090b-4aef-a093-cef82a908261)

I'm going to open a PR
[]
{"login":"domvo","id":17209506,"node_id":"MDQ6VXNlcjE3MjA5NTA2","avatar_url":"https://avatars.githubusercontent.com/u/17209506?v=4","gravatar_id":"","url":"https://api.github.com/users/domvo","html_url":"https://github.com/domvo","followers_url":"https://api.github.com/users/domvo/followers","following_url":"https://api.github.com/users/domvo/following{/other_user}","gists_url":"https://api.github.com/users/domvo/gists{/gist_id}","starred_url":"https://api.github.com/users/domvo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domvo/subscriptions","organizations_url":"https://api.github.com/users/domvo/orgs","repos_url":"https://api.github.com/users/domvo/repos","events_url":"https://api.github.com/users/domvo/events{/privacy}","received_events_url":"https://api.github.com/users/domvo/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-19T15:33:18Z
2023-12-19T15:38:50Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3999/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3999/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3999/timeline
36
https://github.com/reduxjs/redux-toolkit/issues/3996
Feature, QuestionRTKQRTKQ: use forceRefetch to invalidate query data?cache, polling, forceRefetchedge case feature request33996
I have some charts data that I want to invalidate after 180 seconds if query with associated `arg` called. `keepUnusedDataFor` does not suit this case as it invalidates data only if it was not used for the time passed. I want to invalidate it no matter if used or not.

I am trying to do this by `forceRefetch`:
```ts
const CHART_TTL_MS = 1000 * 180;

forceRefetch: ({ endpointState }) => {
if (!endpointState) {
return true;
}

const startedTimeStamp = endpointState.startedTimeStamp;
const nowTimeStamp = new Date().getTime();

if (nowTimeStamp - startedTimeStamp > CHART_TTL_MS) {
return true;
}

...
}
```
This actually works, it starts refetching, but I see "previous" data rendered for a moment before state `isFetching` switching to `true` and I can render some loading view . I could not find any flag or something else to not render that previous data or any way to understand it is going to refetch.

Is there something I missed? Or is it impossible to do invalidation this way?
[]
{"login":"MaximKondratev","id":22473410,"node_id":"MDQ6VXNlcjIyNDczNDEw","avatar_url":"https://avatars.githubusercontent.com/u/22473410?v=4","gravatar_id":"","url":"https://api.github.com/users/MaximKondratev","html_url":"https://github.com/MaximKondratev","followers_url":"https://api.github.com/users/MaximKondratev/followers","following_url":"https://api.github.com/users/MaximKondratev/following{/other_user}","gists_url":"https://api.github.com/users/MaximKondratev/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximKondratev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximKondratev/subscriptions","organizations_url":"https://api.github.com/users/MaximKondratev/orgs","repos_url":"https://api.github.com/users/MaximKondratev/repos","events_url":"https://api.github.com/users/MaximKondratev/events{/privacy}","received_events_url":"https://api.github.com/users/MaximKondratev/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-19T06:01:29Z
2023-12-20T04:30:20Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3996/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3996/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3996/timeline
37
https://github.com/reduxjs/redux-toolkit/issues/3994
BugRTKQIssues using RTK Query outside function componentsoutside functional componentsgood chat here, similar is mentioned in RTKQ Pain Points53994
> @markerikson , this might be a bit of a hijack... sorry. I have a use case that seems pretty reasonable but I just can't get started. I have been happily using RTK for few years and now want to start using RTK Query. Within function components with hooks (as long as I add a few `@ts-ignore`s due to [this](https://github.com/reduxjs/redux-toolkit/issues/3983)), it seems to be working ok.
>
> Unfortunately, I need to be able to also use the store outside of function components (in `inferno` class components via `inferno-redux` -> I have some super-high-performance needs and plain `react` is just too slow...) and I just can't get started. I can't get any of the `examples` here to run and there don't seem to be any instructions on the expected way to run them. The supported way to install now appears to be with `vite` (which I have also been using for years) but most/all of the examples still use `create-react-app`, and I'm getting various different errors trying to install. Because there I couldn't find instructions, I don't know whether I'm just holding it wrong.
>
> It is probably temporary but codesandbox also seems a bit foobared. I tried to download the class-based components example but it refused to download (something about Chrome now refusing sandbox downloads?) and there are also errors when trying to create a github repo.
>
> So I am now a couple of hours in and still can't get an official example running. Is there something else I should be doing? Thanks!
>
> _Originally posted by @AntonOfTheWoods in https://github.com/reduxjs/redux-toolkit/issues/3910#issuecomment-1859440783_
[]
{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false}
COLLABORATORopenFALSE
2023-12-18T22:13:10Z
2023-12-21T15:50:39Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3994/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3994/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3994/timeline
38
https://github.com/reduxjs/redux-toolkit/issues/3989
BugTS, RTKQReturn type of selectFromResult must be Record<string, any> in useQueryState hookselectFromResult useQueryStateLenz says he likes current implementation, OP responds with an example issue23989
When using the `selectFromResult` option in the `useQueryState` hook, the return type is only allowed to be `Record<string, any>`. This limits the usability of the hook as it helps to be able to select a single primitive value in applications like ours where we have lots of values changing fairly rapidly. Functionally, there doesn't seem to be any reason for this limitation, at least none that I can see from taking a look at the source (could be way wrong though 🙂).

I've created a minimal reproduction repo here: https://github.com/KasimAhmic/select-from-result-repro. The `usePostSelector` hook has a type error but is otherwise working exactly as expected.

We have implemented something similar to the function below in our application and have been using it in production for over two years now with no issues whatsoever. The types here are a bit idealistic and in reality we have to do some extra casts here and there to get it past the type checker but this is what it does in essence.

```typescript
export const usePostSelector = <T extends (posts: EntityState<Post, number>) => ReturnType<T>>(
selectorFn: T,
) => {
/**
* Select from state expects a return type of Record<string, any> | undefined but we want to be able
* to return any arbitrary type from the selector function.
*/

return jsonPlaceholderApiEndpoints.getPosts.useQueryState<ReturnType<T>>(undefined, {
selectFromResult: (state) => selectorFn(state.data ?? postsAdapter.getInitialState()),
});
};
```

Taking a look at the source code at `packages/toolkit/src/query/react/buildHooks.ts`, I was able to remove the `extends Record<string, any>` constraints without any issues and I was then able to return whatever I wanted from `selectFromResult`.

```diff
export type QueryStateSelector<
- R extends Record<string, any>,
+ R
D extends QueryDefinition<any, any, any, any>
> = (state: UseQueryStateDefaultResult<D>) => R

export type UseQueryState<D extends QueryDefinition<any, any, any, any>> = <
- R extends Record<string, any> = UseQueryStateDefaultResult<D>
+ R = UseQueryStateDefaultResult<D>
>(
arg: QueryArgFrom<D> | SkipToken,
options?: UseQueryStateOptions<D, R>
) => UseQueryStateResult<D, R>

export type UseQueryStateOptions<
D extends QueryDefinition<any, any, any, any>,
- R extends Record<string, any>
+ R
> = { ... }
```

These changes result in:

```typescript
// Succeeds as expected with no type error, name is type 'string'
const name = jsonPlaceHolderApi.endpoints.getPosts.useQueryState(undefined, {
selectFromResult: (state) =>
postSelectors.selectById(state.data ?? postsAdapter.getInitialState(), postId).name,
});

// Fails as expected with a type error of:
// Type 'string' is not assignable to type 'Record<string, any>'.
const name = jsonPlaceHolderApi.endpoints.getPosts.useQuery(undefined, {
selectFromResult: (state) =>
postSelectors.selectById(state.data ?? postsAdapter.getInitialState(), postId).name,
});
```

Any thoughts on this?

---

Side note, this is tangentially related to #3650 where `selectFromResult` from `useQuery`'s options _must_ return an object conforming to the constraint `Record<string, any>` since `useQuery` attaches a `refetch` function to the result.
[]
{"login":"KasimAhmic","id":1304204,"node_id":"MDQ6VXNlcjEzMDQyMDQ=","avatar_url":"https://avatars.githubusercontent.com/u/1304204?v=4","gravatar_id":"","url":"https://api.github.com/users/KasimAhmic","html_url":"https://github.com/KasimAhmic","followers_url":"https://api.github.com/users/KasimAhmic/followers","following_url":"https://api.github.com/users/KasimAhmic/following{/other_user}","gists_url":"https://api.github.com/users/KasimAhmic/gists{/gist_id}","starred_url":"https://api.github.com/users/KasimAhmic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KasimAhmic/subscriptions","organizations_url":"https://api.github.com/users/KasimAhmic/orgs","repos_url":"https://api.github.com/users/KasimAhmic/repos","events_url":"https://api.github.com/users/KasimAhmic/events{/privacy}","received_events_url":"https://api.github.com/users/KasimAhmic/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-17T20:47:55Z
2023-12-17T22:19:00Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3989/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3989/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3989/timeline
39
https://github.com/reduxjs/redux-toolkit/issues/3988
BugRTKQMemory leak during SSR RTK request after upgrading from 1.9.5 -> ^1.9.6SSR memory leak#3716 reverted and resolved173988
Hello!

So, I'm using this approach for server side prefetching data:
https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering#server-side-rendering-elsewhere
```javascript
const createApi = buildCreateApi(
coreModule(),
reactHooksModule({ unstable__sideEffectsInRender: true })
)

....

store.dispatch(api.endpoints.getSomethingById.initiate(1))

await Promise.all(
store.dispatch(api.util.getRunningQueriesThunk())
)

preloadedState = { ...store.getState() }
```

Before upgrading to RTK v2 and Redux 5 this fills store with specific query and subscription:
```javascript
api: {
queries: {
'getSomethingById(1)': {
status: 'fulfilled',
...
},
mutations: {},
provided: {},
subscriptions: {
'getSomethingById(1)': {
...
}
},
config: {
...
}
}
}
```
After upgrading it looks like:
```javascript
api: {
queries: {
'getSomethingById(1)': {
status: 'fulfilled',
...
},
mutations: {},
provided: {},
subscriptions: {},
config: {
...
}
}
}
```
Subscription is empty.


Also, such server side prefetching leads now to memory leak - server memory consumption grows, however before upgrading there was no such problem on server.

Thanks
[]
{"login":"StopNGo","id":7091805,"node_id":"MDQ6VXNlcjcwOTE4MDU=","avatar_url":"https://avatars.githubusercontent.com/u/7091805?v=4","gravatar_id":"","url":"https://api.github.com/users/StopNGo","html_url":"https://github.com/StopNGo","followers_url":"https://api.github.com/users/StopNGo/followers","following_url":"https://api.github.com/users/StopNGo/following{/other_user}","gists_url":"https://api.github.com/users/StopNGo/gists{/gist_id}","starred_url":"https://api.github.com/users/StopNGo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StopNGo/subscriptions","organizations_url":"https://api.github.com/users/StopNGo/orgs","repos_url":"https://api.github.com/users/StopNGo/repos","events_url":"https://api.github.com/users/StopNGo/events{/privacy}","received_events_url":"https://api.github.com/users/StopNGo/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-17T12:22:21Z
2024-01-11T13:32:26Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3988/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3988/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3988/timeline
40
https://github.com/reduxjs/redux-toolkit/issues/3979
FeatureRTKQinvalidationBehavior: 'delayed' behavior for sequential mutationsinvalidationBehaviour sequential mutationsIndepth issue log - could be related to #34520
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3979
I have created a [codesandbox ](https://codesandbox.io/p/devbox/m7jsmv?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clq6dvvup0006356riqacodnu%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clq6dvvup0002356ri8wkteim%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clq6dvvup0003356rm4jh0v2p%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clq6dvvup0005356r4qinyudg%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clq6dvvup0002356ri8wkteim%2522%253A%257B%2522id%2522%253A%2522clq6dvvup0002356ri8wkteim%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clq6dvvup0005356r4qinyudg%2522%253A%257B%2522id%2522%253A%2522clq6dvvup0005356r4qinyudg%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522start%2522%252C%2522port%2522%253A3000%252C%2522id%2522%253A%2522clq6eyyws008f356rq4loafqv%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clq6eyyws008f356rq4loafqv%2522%257D%252C%2522clq6dvvup0003356rm4jh0v2p%2522%253A%257B%2522id%2522%253A%2522clq6dvvup0003356rm4jh0v2p%2522%252C%2522activeTabId%2522%253A%2522clq6eyyta006t356rtt5vtoaf%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%2522%252C%2522id%2522%253A%2522clq6eyyta006t356rtt5vtoaf%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%252C%257B%2522id%2522%253A%2522clq6f39se00m6356rlqjc4p4q%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522clq6gjdfi0009egi6184h9glh%2522%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522CSB_RUN_OUTSIDE_CONTAINER%253D1%2520devcontainer%2520templates%2520apply%2520--template-id%2520%255C%2522ghcr.io%252Fdevcontainers%252Ftemplates%252Ftypescript-node%255C%2522%2520--template-args%2520%27%257B%257D%27%2520--features%2520%27%255B%255D%27%2522%252C%2522id%2522%253A%2522clq6gtvxa030c356r15vsyd3k%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A16.35416666666667%257D) to display the problem.

TLDR: Two sequentially fired mutations that invalidate the same two tags, makes second invalidation wait for first queries to finish.

I have 3 cases displayed there (last one behaves weirdly):
1. Press the button "Run 1 mutation". Mutation is fired and when it succeeds, it invalidates 2 tags, that in-turn fire short and long queries. Thats all good 👍
![image](https://github.com/reduxjs/redux-toolkit/assets/16189897/33043ca6-ca73-4b4d-812f-95f09b70add7)
2. Press the button "Run 2 mutations in parallel". Mutation 1 (shorter) and Mutation 2(longer) are fired at the same time.
![image](https://github.com/reduxjs/redux-toolkit/assets/16189897/9ca6cc4f-b5b6-4d43-8110-321de849da54)
They both invalidate the same 2 tags. You can see in the network tab, that the "short" and "long" query fire only when the longer mutation has finished. Thats all good 👍
![image](https://github.com/reduxjs/redux-toolkit/assets/16189897/68ba90a0-bc4b-4f3a-9d56-f778a378d245)
4. Press the button "Run 2 mutations sequentially".
![image](https://github.com/reduxjs/redux-toolkit/assets/16189897/8878f409-d3ab-4b9d-8ca0-90d41d6da995)
The second mutation is called when the first one is completed. But because the first mutation is completed the two tags are invalidated and "short" and "long" queries are also fired. Even when the second mutation completes, it waits for both "short" and "long" query to finish, to invalidate its tags and re-fire "short" and "long" queries to get the latest state from BE. Thats bad 👎
![image](https://github.com/reduxjs/redux-toolkit/assets/16189897/2edc9b26-b181-4544-8bc6-6ce7b81f0941)

I think the current behaviour for sequential mutation is not correct.
Options how it could be better:

- ![Option1](https://github.com/reduxjs/redux-toolkit/assets/16189897/43c28fa2-a617-46bf-a666-3214a20f4087)
- ![Option2](https://github.com/reduxjs/redux-toolkit/assets/16189897/fa3ad3de-3c03-42bf-99f4-f0683604c1a7)
- ![Option3](https://github.com/reduxjs/redux-toolkit/assets/16189897/88b2d78a-752b-4571-ae5b-6ea00ef85a0a)


[]
{"login":"HarlesPilter","id":16189897,"node_id":"MDQ6VXNlcjE2MTg5ODk3","avatar_url":"https://avatars.githubusercontent.com/u/16189897?v=4","gravatar_id":"","url":"https://api.github.com/users/HarlesPilter","html_url":"https://github.com/HarlesPilter","followers_url":"https://api.github.com/users/HarlesPilter/followers","following_url":"https://api.github.com/users/HarlesPilter/following{/other_user}","gists_url":"https://api.github.com/users/HarlesPilter/gists{/gist_id}","starred_url":"https://api.github.com/users/HarlesPilter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HarlesPilter/subscriptions","organizations_url":"https://api.github.com/users/HarlesPilter/orgs","repos_url":"https://api.github.com/users/HarlesPilter/repos","events_url":"https://api.github.com/users/HarlesPilter/events{/privacy}","received_events_url":"https://api.github.com/users/HarlesPilter/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-15T11:45:25Z
2023-12-15T12:02:55Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3979/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3979/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3979/timeline
41
https://github.com/reduxjs/redux-toolkit/issues/3973BugRTKQ, 2.0[Vitest - RTK Query - MSW] Store not updating in specific case after upgrade to RTK v2 and react-redux v9msw, vitestlenz/mark responses 6
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/13","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13/labels","id":10275572,"node_id":"MI_kwDOB2ACAs4AnMr0","number":13,"title":"2.x bugfixes","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":6,"state":"open","created_at":"2023-12-06T12:49:04Z","updated_at":"2024-01-21T01:26:46Z","due_on":null,"closed_at":null}
3973
Hello everyone,

in our project we use Vitest as the test runner and MSW to mock endpoint calls.

## Issue

When I upgrade react-redux: 8.1.3 => 9.0.4 and RTK: 1.9.7 => 2.0.1, some tests start to fail.

We have a selector that access an RTK Query in the following way:
```js
const selectUserResult = userApi.endpoints.getUser.select();

export const selectUser = createSelector(
selectUserResult,
(userResult) =>
userResult.data ?? { Id: "", Email: "", Permissions: [] as Array<string> },
);
```

In the real application we call the getUser endpoint before rendering the React application and it works fine when we upgrade the versions.

During testing we execute the api call manually and mock it out with MSW; with the v8/v1 versions the selector updates correctly while, on the latter versions, the selector doesn't change after the first render.

## Steps to reproduce

I created this [CodeSandbox sample](https://codesandbox.io/p/devbox/vitest-bug-redux5-ll9fgw) with the minimum amount of code to reproduce the issue.

If you run the test terminal with the sandbox as-it-is, you'll see the successful tests; if you upgrade the versions the tests will fail (you'll see in the logging the different behavior).

## Additional info

If it's not a bug, can you kindly point us to a different approach to get the API results in a selector function?

Thanks for the help 🤗
[]
{"login":"followynne","id":32459930,"node_id":"MDQ6VXNlcjMyNDU5OTMw","avatar_url":"https://avatars.githubusercontent.com/u/32459930?v=4","gravatar_id":"","url":"https://api.github.com/users/followynne","html_url":"https://github.com/followynne","followers_url":"https://api.github.com/users/followynne/followers","following_url":"https://api.github.com/users/followynne/following{/other_user}","gists_url":"https://api.github.com/users/followynne/gists{/gist_id}","starred_url":"https://api.github.com/users/followynne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/followynne/subscriptions","organizations_url":"https://api.github.com/users/followynne/orgs","repos_url":"https://api.github.com/users/followynne/repos","events_url":"https://api.github.com/users/followynne/events{/privacy}","received_events_url":"https://api.github.com/users/followynne/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-13T10:42:10Z
2023-12-14T21:34:30Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3973/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3973/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3973/timeline
42
https://github.com/reduxjs/redux-toolkit/issues/3972BugRTKQRTK Query not skipping when cache invalidatedcache skip - subscriptions issueThis particular issue is resolved but pains around subscriptions seem recurring73972
I have a generated hook that's created from an OpenApi spec with a custom tag. We are invalidating the cached data from a modal and I'm passing the skip option to the hook:
`const {
data: { reply: purchaseOrderHeader = [] } = {},
isLoading: POLoading,
} = useGetApiGetPurchaseOrderHeadersByIdQuery(
{
id: Number(purchaseorder),
},
{ skip: !purchaseorder || buyListModalOpen}
);`

The general idea is that when the modal is open the caching should wait to run, this is to avoid render cycles and flashes on the DataGrid component this populates, and this pattern works for 2 other hooks on the same page that are also invalidated. This always runs despite the skip, no matter the argument order, and looking at Redux Devtools a force refetch is passed in the meta arguments, which is not defined in the generated spec or enhanced endpoints. Am I misunderstanding something here?
[]
{"login":"Ocoldwell","id":75363386,"node_id":"MDQ6VXNlcjc1MzYzMzg2","avatar_url":"https://avatars.githubusercontent.com/u/75363386?v=4","gravatar_id":"","url":"https://api.github.com/users/Ocoldwell","html_url":"https://github.com/Ocoldwell","followers_url":"https://api.github.com/users/Ocoldwell/followers","following_url":"https://api.github.com/users/Ocoldwell/following{/other_user}","gists_url":"https://api.github.com/users/Ocoldwell/gists{/gist_id}","starred_url":"https://api.github.com/users/Ocoldwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ocoldwell/subscriptions","organizations_url":"https://api.github.com/users/Ocoldwell/orgs","repos_url":"https://api.github.com/users/Ocoldwell/repos","events_url":"https://api.github.com/users/Ocoldwell/events{/privacy}","received_events_url":"https://api.github.com/users/Ocoldwell/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-12T11:47:15Z
2023-12-16T17:37:58Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3972/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3972/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3972/timeline
43
https://github.com/reduxjs/redux-toolkit/issues/3970
BugRTKQError with tsc when attempting to import types from RTK Query using @reduxjs/toolkit 2.0.1tsconfig import types8
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/13","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13/labels","id":10275572,"node_id":"MI_kwDOB2ACAs4AnMr0","number":13,"title":"2.x bugfixes","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":6,"state":"open","created_at":"2023-12-06T12:49:04Z","updated_at":"2024-01-21T01:26:46Z","due_on":null,"closed_at":null}
3970
>Sample repo reproducing the issue can be found here: https://github.com/ryerrappa/rtk-query-type-import-issue

- @reduxjs/tookit 2.0.1
- Vite 5.0.0
- Typescript 5.2.2
- tsconfig moduleResolution "bundler"

Receive the following error when attempting to import the `MutationTrigger` type.

```
Cannot find module @reduxjs/toolkit/dist/query/react/buildHooks
```

Using vite with the following tsconfig.

```json
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
```
[]
{"login":"ryerrappa","id":8597084,"node_id":"MDQ6VXNlcjg1OTcwODQ=","avatar_url":"https://avatars.githubusercontent.com/u/8597084?v=4","gravatar_id":"","url":"https://api.github.com/users/ryerrappa","html_url":"https://github.com/ryerrappa","followers_url":"https://api.github.com/users/ryerrappa/followers","following_url":"https://api.github.com/users/ryerrappa/following{/other_user}","gists_url":"https://api.github.com/users/ryerrappa/gists{/gist_id}","starred_url":"https://api.github.com/users/ryerrappa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryerrappa/subscriptions","organizations_url":"https://api.github.com/users/ryerrappa/orgs","repos_url":"https://api.github.com/users/ryerrappa/repos","events_url":"https://api.github.com/users/ryerrappa/events{/privacy}","received_events_url":"https://api.github.com/users/ryerrappa/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-10T14:53:03Z
2023-12-16T08:51:26Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3970/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3970/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3970/timeline
44
https://github.com/reduxjs/redux-toolkit/issues/3964
FeatureTS, RTKQendpointDefinitions not exported from @reduxjs/toolkit/queryendpointDefinitions type export33964
Hello I am using some types from `endpointDefinitions` to define `transformedResponse `return type in my endpoint enhancing, the problem is that after updating `@reduxjs/toolkit` to version 2.0.1 I am not able to import them from `@reduxjs/toolkit/query`, and this url is deepest I am allowed to go down the tree.

`"@reduxjs/toolkit": "^2.0.1",`

```
import {
DefinitionsFromApi,
OverrideResultType,
TagTypesFromApi
} from '@reduxjs/toolkit/query';
```
[]
{"login":"zudenkovas","id":31995727,"node_id":"MDQ6VXNlcjMxOTk1NzI3","avatar_url":"https://avatars.githubusercontent.com/u/31995727?v=4","gravatar_id":"","url":"https://api.github.com/users/zudenkovas","html_url":"https://github.com/zudenkovas","followers_url":"https://api.github.com/users/zudenkovas/followers","following_url":"https://api.github.com/users/zudenkovas/following{/other_user}","gists_url":"https://api.github.com/users/zudenkovas/gists{/gist_id}","starred_url":"https://api.github.com/users/zudenkovas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zudenkovas/subscriptions","organizations_url":"https://api.github.com/users/zudenkovas/orgs","repos_url":"https://api.github.com/users/zudenkovas/repos","events_url":"https://api.github.com/users/zudenkovas/events{/privacy}","received_events_url":"https://api.github.com/users/zudenkovas/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-08T12:35:20Z
2024-01-07T16:14:06Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3964/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3964/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3964/timeline
46
https://github.com/reduxjs/redux-toolkit/issues/3961
BugRTKQ-Code-Gen@reduxjs/rtk-codemods ts-node mismatch errorts-node error13961
I encountered a TypeScript error when running the `@reduxjs/rtk-codemods` tool. The command executed was:

```bash
npx @reduxjs/rtk-codemods createReducerBuilder ./src
```

**Error Message**:

```zsh
/node_modules/@reduxjs/rtk-codemods/node_modules/typescript/lib/typescript.js:43500

ts.Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");

Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.
```

**Temporary Solution**:
In an attempt to debug this issue, I installed `rtk-codemods` package locally and made the following changes:
1. Updated the `ts-node` version to the latest (10.9.1).
2. Temporarily commented out the `ast-types` package due to a subsequent error (`Cannot find module 'ast-types/gen/kinds' or its corresponding type declarations.`).

After these modifications, `rtk-codemods` ran as expected. Any guidance on resolving this issue without these temporary fixes would be great but leaving incase it helps.

**Note**: I was working with `@reduxjs/rtk-codemods` **v0.0.3** but it looks like the latest commits remove ts-node so maybe this will be fixed in an upcoming release?
[]
{"login":"andreaHG","id":24516465,"node_id":"MDQ6VXNlcjI0NTE2NDY1","avatar_url":"https://avatars.githubusercontent.com/u/24516465?v=4","gravatar_id":"","url":"https://api.github.com/users/andreaHG","html_url":"https://github.com/andreaHG","followers_url":"https://api.github.com/users/andreaHG/followers","following_url":"https://api.github.com/users/andreaHG/following{/other_user}","gists_url":"https://api.github.com/users/andreaHG/gists{/gist_id}","starred_url":"https://api.github.com/users/andreaHG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreaHG/subscriptions","organizations_url":"https://api.github.com/users/andreaHG/orgs","repos_url":"https://api.github.com/users/andreaHG/repos","events_url":"https://api.github.com/users/andreaHG/events{/privacy}","received_events_url":"https://api.github.com/users/andreaHG/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-07T21:26:43Z
2023-12-11T09:51:11Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3961/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3961/reactions","total_count":2,"+1":2,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3961/timeline
47
https://github.com/reduxjs/redux-toolkit/issues/3952
Bug, QuestionRTKQextraOptions - retryCondition - Property 'originalStatus' does not exist on type 'FetchBaseQueryError'.originalStatus13952
The current implementation of the retryCondition function references a property called originalStatus in the result object, which is not present in the current structure.
```
extraOptions: {
retryCondition(result, _, { attempt }) {
if (result.originalStatus >= 400 && attempt < 3) {
return true;
}
return false;
}
}
```

am I doing something wrong?

Environment:
Version: 1.8.5
[]
{"login":"renanloboz","id":120129007,"node_id":"U_kgDOBykF7w","avatar_url":"https://avatars.githubusercontent.com/u/120129007?v=4","gravatar_id":"","url":"https://api.github.com/users/renanloboz","html_url":"https://github.com/renanloboz","followers_url":"https://api.github.com/users/renanloboz/followers","following_url":"https://api.github.com/users/renanloboz/following{/other_user}","gists_url":"https://api.github.com/users/renanloboz/gists{/gist_id}","starred_url":"https://api.github.com/users/renanloboz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renanloboz/subscriptions","organizations_url":"https://api.github.com/users/renanloboz/orgs","repos_url":"https://api.github.com/users/renanloboz/repos","events_url":"https://api.github.com/users/renanloboz/events{/privacy}","received_events_url":"https://api.github.com/users/renanloboz/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-05T22:13:58Z
2023-12-06T12:40:01Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3952/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3952/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3952/timeline
48
https://github.com/reduxjs/redux-toolkit/issues/3942
BugRTKQInfinite request loop when prefetching data from URL that returns errorprefetchhas a sandbox for repro. Also probably a bad bug if its real03942
Hey!
I've encountered this problem lately and I was wondering what could I do with that.

I have this piece of code

<details>

```tsx
import * as React from 'react'
import { useGetPokemonByNameQuery } from './services/pokemon'

export default function App() {
const { isLoading } = useGetPokemonByNameQuery('bulbasaur')

return (
<div className="App">
{isLoading ? 'Loading...' : <Pokemon name={'bulbasaur'} />}
</div>
)
}

export const Pokemon = ({ name }: { name: string }) => {
const {} = useGetPokemonByNameQuery(name)

return (
<div>
Pokemon
</div>
)
}
```

</details>

Link to codesanbox: [LINK](https://codesandbox.io/p/sandbox/redux-toolkit-rtk-query-forked-32p8cv?file=%2Fsrc%2Fservices%2Fpokemon.ts%3A14%2C1&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clpmpjwor00063b6kz9jr7xjp%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clpmpjwor00023b6kqaptvxtd%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clpmpjwor00033b6kc6jl22gy%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clpmpjwpz000i3b6k9ijvq43n%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B70.59573800086339%252C29.404261999136608%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clpmpjwpz000i3b6k9ijvq43n%2522%253A%257B%2522id%2522%253A%2522clpmpjwpz000i3b6k9ijvq43n%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clpmpjwor00023b6kqaptvxtd%2522%253A%257B%2522id%2522%253A%2522clpmpjwor00023b6kqaptvxtd%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clpmpjwor00033b6kc6jl22gy%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clpmpjwor00033b6kc6jl22gy%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D)

Basically the theme here is:
1. I want to preload some data, therefore I use `useGetPokemonByNameQuery` in parent component
2. When the data is loading I'm not rendering child component.
3. When the data is preloaded I want to display the data in child component using the same hook

And everything works well when the request was succesful.
Unfortunately when the request fails continuously (like in the sandbox there is wrong URL) there is infinite loop of requests coming from RTK query

I was wondering if you could help me with solution here?
[]
{"login":"KostkaBrukowa","id":35625949,"node_id":"MDQ6VXNlcjM1NjI1OTQ5","avatar_url":"https://avatars.githubusercontent.com/u/35625949?v=4","gravatar_id":"","url":"https://api.github.com/users/KostkaBrukowa","html_url":"https://github.com/KostkaBrukowa","followers_url":"https://api.github.com/users/KostkaBrukowa/followers","following_url":"https://api.github.com/users/KostkaBrukowa/following{/other_user}","gists_url":"https://api.github.com/users/KostkaBrukowa/gists{/gist_id}","starred_url":"https://api.github.com/users/KostkaBrukowa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KostkaBrukowa/subscriptions","organizations_url":"https://api.github.com/users/KostkaBrukowa/orgs","repos_url":"https://api.github.com/users/KostkaBrukowa/repos","events_url":"https://api.github.com/users/KostkaBrukowa/events{/privacy}","received_events_url":"https://api.github.com/users/KostkaBrukowa/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-12-04T07:29:30Z
2023-12-04T07:29:30Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3942/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3942/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3942/timeline
51
https://github.com/reduxjs/redux-toolkit/issues/3923FeatureRTKQ-Code-Gen@rtk-query/codegen-openapi code: Ignore /api prefix for namingoption for ignore prefix03923
Our API endpoints are prefixed with /api.

Would be nice to be able to ignore this prefix in the config.

**Current result:**
`
getApiUser: build.query<GetApiUserApiResponse, GetApiUserApiArg>({
query: () => ({ url: '/api/user' })
})
`

**Desired result:**
`
getUser: build.query<GetUserApiResponse, GetUserApiArg>({
query: () => ({ url: '/api/user' })
})
`
[]
{"login":"andordavoti","id":24613178,"node_id":"MDQ6VXNlcjI0NjEzMTc4","avatar_url":"https://avatars.githubusercontent.com/u/24613178?v=4","gravatar_id":"","url":"https://api.github.com/users/andordavoti","html_url":"https://github.com/andordavoti","followers_url":"https://api.github.com/users/andordavoti/followers","following_url":"https://api.github.com/users/andordavoti/following{/other_user}","gists_url":"https://api.github.com/users/andordavoti/gists{/gist_id}","starred_url":"https://api.github.com/users/andordavoti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andordavoti/subscriptions","organizations_url":"https://api.github.com/users/andordavoti/orgs","repos_url":"https://api.github.com/users/andordavoti/repos","events_url":"https://api.github.com/users/andordavoti/events{/privacy}","received_events_url":"https://api.github.com/users/andordavoti/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-30T12:01:52Z
2023-11-30T12:01:52Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3923/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3923/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3923/timeline
52
https://github.com/reduxjs/redux-toolkit/issues/3919
BugTS, RTKQ-Code-Gen@rtk-query/codegen-openapi code: Cannot find module 'deepmerge'oazapfts or imports03919
When running `npx @rtk-query/codegen-openapi ...` using version 1.2.0 I am getting the following error:
```sh
Generating ./api.ts
Error: Cannot find module 'deepmerge'
Require stack:
- /Users/graham/.npm/_npx/0c161120d443de8e/node_modules/oazapfts/lib/codegen/generate.js
- /Users/graham/.npm/_npx/0c161120d443de8e/node_modules/@rtk-query/codegen-openapi/lib/generate.js
- /Users/graham/.npm/_npx/0c161120d443de8e/node_modules/@rtk-query/codegen-openapi/lib/index.js
- /Users/graham/.npm/_npx/0c161120d443de8e/node_modules/@rtk-query/codegen-openapi/lib/bin/cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at Object.<anonymous> (/Users/graham/.npm/_npx/0c161120d443de8e/node_modules/oazapfts/lib/codegen/generate.js:35:37)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/graham/.npm/_npx/0c161120d443de8e/node_modules/oazapfts/lib/codegen/generate.js',
'/Users/graham/.npm/_npx/0c161120d443de8e/node_modules/@rtk-query/codegen-openapi/lib/generate.js',
'/Users/graham/.npm/_npx/0c161120d443de8e/node_modules/@rtk-query/codegen-openapi/lib/index.js',
'/Users/graham/.npm/_npx/0c161120d443de8e/node_modules/@rtk-query/codegen-openapi/lib/bin/cli.js'
]
}
```

This was an issue with `oazapfts` not including the `deepmerge` dependency. I opened an issue about it on the `oazapfts` repository [here](https://github.com/oazapfts/oazapfts/issues/526) which has been resolved in release `4.11.1`.

Is it worth explicitly excluding `"oazapfts": "4.11.0"` and/or bumping the requirement to `^4.11.1` which includes a fix? While the issue should be solved when using `@rtk-query/codegen-openapi` with npx as it will use the latest version it might persist (depending on dependency resolution) when installing the package.
[]
{"login":"grahamsawers","id":48787931,"node_id":"MDQ6VXNlcjQ4Nzg3OTMx","avatar_url":"https://avatars.githubusercontent.com/u/48787931?v=4","gravatar_id":"","url":"https://api.github.com/users/grahamsawers","html_url":"https://github.com/grahamsawers","followers_url":"https://api.github.com/users/grahamsawers/followers","following_url":"https://api.github.com/users/grahamsawers/following{/other_user}","gists_url":"https://api.github.com/users/grahamsawers/gists{/gist_id}","starred_url":"https://api.github.com/users/grahamsawers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grahamsawers/subscriptions","organizations_url":"https://api.github.com/users/grahamsawers/orgs","repos_url":"https://api.github.com/users/grahamsawers/repos","events_url":"https://api.github.com/users/grahamsawers/events{/privacy}","received_events_url":"https://api.github.com/users/grahamsawers/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-29T11:19:38Z
2023-11-29T11:19:38Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3919/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3919/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3919/timeline
53
https://github.com/reduxjs/redux-toolkit/issues/3918
BugRTKQ-Code-Gen@rtk-query/codegen-openapi SyntaxError for bigger api schemaoazapfts or imports23918
I am trying to generate api with
`npx @rtk-query/codegen-openapi ./src/rqStore/apiConfigs/userConfig.ts`

but I have error:

> Generating ../hooks/userApi.ts
> SyntaxError: Type expected. (829:30)
> 827 | fleetNote4?: string;
> 828 | };
> > 829 | export type FleetEntityDto = ;
> | ^
> 830 | export type FleetEntityCreateResponse = {
> 831 | id?: string;
> 832 | };
> at v (/prj112/node_modules/prettier/parser-typescript.js:1:14679)
> at _H (/prj112/node_modules/prettier/parser-typescript.js:49:10722)
> at Object.cH [as parse] (/prj112/node_modules/prettier/parser-typescript.js:49:11028)
> at Object.parse (/prj112/node_modules/prettier/index.js:7515:23)
> at coreFormat (/prj112/node_modules/prettier/index.js:8829:18)
> at formatWithCursor2 (/prj112/node_modules/prettier/index.js:9021:18)
> at /prj112/node_modules/prettier/index.js:38183:12
> at Object.format (/prj112/node_modules/prettier/index.js:38197:12)
> at prettify (/prj112/node_modules/@rtk-query/codegen-openapi/src/utils/prettier.ts:35:19)
> at async generateEndpoints (/prj112/node_modules/@rtk-query/codegen-openapi/src/index.ts:20:63) {
> loc: { start: { line: 829, column: 30 } },
> codeFrame: '\x1B[0m \x1B[90m 827 |\x1B[39m fleetNote4\x1B[33m?\x1B[39m\x1B[33m:\x1B[39m string\x1B[33m;\x1B[39m\x1B[0m\n' +
> '\x1B[0m \x1B[90m 828 |\x1B[39m }\x1B[33m;\x1B[39m\x1B[0m\n' +
> '\x1B[0m\x1B[31m\x1B[1m>\x1B[22m\x1B[39m\x1B[90m 829 |\x1B[39m \x1B[36mexport\x1B[39m type \x1B[33mFleetEntityDto\x1B[39m \x1B[33m=\x1B[39m \x1B[33m;\x1B[39m\x1B[0m\n' +
> '\x1B[0m \x1B[90m |\x1B[39m \x1B[31m\x1B[1m^\x1B[22m\x1B[39m\x1B[0m\n' +
> '\x1B[0m \x1B[90m 830 |\x1B[39m \x1B[36mexport\x1B[39m type \x1B[33mFleetEntityCreateResponse\x1B[39m \x1B[33m=\x1B[39m {\x1B[0m\n' +
> '\x1B[0m \x1B[90m 831 |\x1B[39m id\x1B[33m?\x1B[39m\x1B[33m:\x1B[39m string\x1B[33m;\x1B[39m\x1B[0m\n' +

"@rtk-query/codegen-openapi": "^1.2.0",

I checked it with `@rtk-incubator/rtk-query-codegen-openapi` and it has no problem with the same API schema.
[]
{"login":"vladinko0","id":16008547,"node_id":"MDQ6VXNlcjE2MDA4NTQ3","avatar_url":"https://avatars.githubusercontent.com/u/16008547?v=4","gravatar_id":"","url":"https://api.github.com/users/vladinko0","html_url":"https://github.com/vladinko0","followers_url":"https://api.github.com/users/vladinko0/followers","following_url":"https://api.github.com/users/vladinko0/following{/other_user}","gists_url":"https://api.github.com/users/vladinko0/gists{/gist_id}","starred_url":"https://api.github.com/users/vladinko0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladinko0/subscriptions","organizations_url":"https://api.github.com/users/vladinko0/orgs","repos_url":"https://api.github.com/users/vladinko0/repos","events_url":"https://api.github.com/users/vladinko0/events{/privacy}","received_events_url":"https://api.github.com/users/vladinko0/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-29T10:07:48Z
2023-12-05T17:13:54Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3918/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3918/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3918/timeline
55
https://github.com/reduxjs/redux-toolkit/issues/3914
DiscussionDocs, RTKQCustom reconciling in `extractRehydrationInfo`next, hydration73914
Currently, `extractRehydrationInfo` is a black box receiving just the action and the reducer path. This makes it impossible to do even simple logic to reconcile the two states of the queries, here's a simple scenario
1. the hydration action is called with data A, now the query contains fresh data A
2. the query is refreshed, now the query contains fresh data B
3. the hydration action is called with data A again, now stale A has overwritten fresh B

Maybe I'm missing something, but right now there's no way to reconcile in a custom way to avoid scenarios like the one described above.
[]
{"login":"nevnein","id":12485857,"node_id":"MDQ6VXNlcjEyNDg1ODU3","avatar_url":"https://avatars.githubusercontent.com/u/12485857?v=4","gravatar_id":"","url":"https://api.github.com/users/nevnein","html_url":"https://github.com/nevnein","followers_url":"https://api.github.com/users/nevnein/followers","following_url":"https://api.github.com/users/nevnein/following{/other_user}","gists_url":"https://api.github.com/users/nevnein/gists{/gist_id}","starred_url":"https://api.github.com/users/nevnein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nevnein/subscriptions","organizations_url":"https://api.github.com/users/nevnein/orgs","repos_url":"https://api.github.com/users/nevnein/repos","events_url":"https://api.github.com/users/nevnein/events{/privacy}","received_events_url":"https://api.github.com/users/nevnein/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-27T16:12:17Z
2023-11-29T23:27:59Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3914/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3914/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3914/timeline
59
https://github.com/reduxjs/redux-toolkit/issues/3898
Feature, QuestionRTKQRTKQ: useLazyQuery + refetchOnMountOrArgChangeuseLazyQuery refetchOnMountOrArgsChange03898
Hey!
`useQuery` hook accepts `refetchOnMountOrArgChange` option. I find it very helpful when I need to refetch the data from the API after some time passed.

I'd like to achieve exact same results but with `useLazyQuery`:
1. There is a component rendered with button.
2. When button is clicked - call `trigger` from `useLazyQuery`.
3. When the button is clicked again within 5s - serve the data from cache
4. When the button is clicked after 5s - make API request

Is it currently achievable? I tried many things but couldn't get it working like that with `useLazyQuery` hook.

Thanks!

[]
{"login":"sucat","id":7252341,"node_id":"MDQ6VXNlcjcyNTIzNDE=","avatar_url":"https://avatars.githubusercontent.com/u/7252341?v=4","gravatar_id":"","url":"https://api.github.com/users/sucat","html_url":"https://github.com/sucat","followers_url":"https://api.github.com/users/sucat/followers","following_url":"https://api.github.com/users/sucat/following{/other_user}","gists_url":"https://api.github.com/users/sucat/gists{/gist_id}","starred_url":"https://api.github.com/users/sucat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sucat/subscriptions","organizations_url":"https://api.github.com/users/sucat/orgs","repos_url":"https://api.github.com/users/sucat/repos","events_url":"https://api.github.com/users/sucat/events{/privacy}","received_events_url":"https://api.github.com/users/sucat/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-20T20:37:05Z
2023-11-20T20:37:05Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3898/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3898/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3898/timeline
60
https://github.com/reduxjs/redux-toolkit/issues/3888
BugRTKQRTK form data is not sent to the serverformData, headers53888

I am currently writing a chat app, where user can upload avatar picture, for that I use nestJs and their multer abstraction package, all works well with POSTMAN meaning that I can update file from it, however when trying to upload file from the front-end react app I have error. The back-end server act as file is undefined however by checking the browser request I can see that request with body and content-type set to multipart data was sent, but nothing is received by the server while when sending data through POSTMAN all works just fine

Here the react query mutation that should handle the upload avatar functionality
```js
changeAvatar: builder.mutation<
BaseServerResponse & {
data: { message: string; statusCode: number; data: string };
},
Blob
>({
query: (file) => {
const formData = new FormData();
formData.append("avatar", file);
console.log({ formData, file });
return {
url: "/files/upload-avatar",
method: "POST",
body: formData,
formData: true,
Accept: "*/*",
};
},
}),
```
[]
{"login":"dieriba","id":81977367,"node_id":"MDQ6VXNlcjgxOTc3MzY3","avatar_url":"https://avatars.githubusercontent.com/u/81977367?v=4","gravatar_id":"","url":"https://api.github.com/users/dieriba","html_url":"https://github.com/dieriba","followers_url":"https://api.github.com/users/dieriba/followers","following_url":"https://api.github.com/users/dieriba/following{/other_user}","gists_url":"https://api.github.com/users/dieriba/gists{/gist_id}","starred_url":"https://api.github.com/users/dieriba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dieriba/subscriptions","organizations_url":"https://api.github.com/users/dieriba/orgs","repos_url":"https://api.github.com/users/dieriba/repos","events_url":"https://api.github.com/users/dieriba/events{/privacy}","received_events_url":"https://api.github.com/users/dieriba/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-17T02:10:12Z
2024-01-22T09:07:51Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3888/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3888/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3888/timeline
61
https://github.com/reduxjs/redux-toolkit/issues/3880
FeatureTS, Docs, RTKQ-Code-Gen[RTK Query Code Generation] useEnumType is absent in the SimpleUsage interfaceuseEnumType simpleUsage03880
Current docs: https://redux-toolkit.js.org/rtk-query/usage/code-generation#config-file-options, doesn`t provide information about **useEnumType**

New interface should be:
```ts
interface SimpleUsage {
apiFile: string
schemaFile: string
apiImport?: string
exportName?: string
argSuffix?: string
responseSuffix?: string
hooks?:
| boolean
| { queries: boolean; lazyQueries: boolean; mutations: boolean }
tag?: boolean
outputFile: string
filterEndpoints?:
| string
| RegExp
| EndpointMatcherFunction
| Array<string | RegExp | EndpointMatcherFunction>
endpointOverrides?: EndpointOverrides[]
flattenArg?: boolean
useEnumType?: boolean
}
```
[]
{"login":"Tornik73","id":29804763,"node_id":"MDQ6VXNlcjI5ODA0NzYz","avatar_url":"https://avatars.githubusercontent.com/u/29804763?v=4","gravatar_id":"","url":"https://api.github.com/users/Tornik73","html_url":"https://github.com/Tornik73","followers_url":"https://api.github.com/users/Tornik73/followers","following_url":"https://api.github.com/users/Tornik73/following{/other_user}","gists_url":"https://api.github.com/users/Tornik73/gists{/gist_id}","starred_url":"https://api.github.com/users/Tornik73/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tornik73/subscriptions","organizations_url":"https://api.github.com/users/Tornik73/orgs","repos_url":"https://api.github.com/users/Tornik73/repos","events_url":"https://api.github.com/users/Tornik73/events{/privacy}","received_events_url":"https://api.github.com/users/Tornik73/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-15T10:46:53Z
2023-11-15T10:48:37Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3880/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3880/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3880/timeline
63
https://github.com/reduxjs/redux-toolkit/issues/3870
BugRTKQ`Accept` header missing if `responseHandler === 'json'`header responseHandler03870
if the `responseHandler` equals to `json` (the default), rtk doesn't set the `Accept` header to `application/json`, effectively allowing the server to send any response format, since the default for `Accept` is `*/*`. however, this is in contradiction to that we _expect_ json to be returned from the server, since this is what our configured handler will parse. I was quite surprised by that so maybe I'm missing something. let me know!

most server will probably happily respond with json, even though `Accept` is not set properly. but this is just due to that most apis only support json, so they always return json and pay no attention to the header. but apis also returning other formats, lets say xml and html, might return xml, if that is their default, instead of json, if the `Accept` header is not constraining the expected format.

it could be also argued that `Accept` should be `text/plain` if the `responseHandler` is `text`, but that might be too far, since "plain text" is not well defined (or we expect html or similar as a response, which is handled as `'text'` as well), compared to json.
[]
{"login":"pseidemann","id":431162,"node_id":"MDQ6VXNlcjQzMTE2Mg==","avatar_url":"https://avatars.githubusercontent.com/u/431162?v=4","gravatar_id":"","url":"https://api.github.com/users/pseidemann","html_url":"https://github.com/pseidemann","followers_url":"https://api.github.com/users/pseidemann/followers","following_url":"https://api.github.com/users/pseidemann/following{/other_user}","gists_url":"https://api.github.com/users/pseidemann/gists{/gist_id}","starred_url":"https://api.github.com/users/pseidemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pseidemann/subscriptions","organizations_url":"https://api.github.com/users/pseidemann/orgs","repos_url":"https://api.github.com/users/pseidemann/repos","events_url":"https://api.github.com/users/pseidemann/events{/privacy}","received_events_url":"https://api.github.com/users/pseidemann/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-13T19:26:21Z
2023-11-13T19:26:21Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3870/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3870/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3870/timeline
64
https://github.com/reduxjs/redux-toolkit/issues/3866
BugRTKQ-Code-GenRTKQuery Codegen execution errorts-node error03866
![image](https://github.com/reduxjs/redux-toolkit/assets/112059651/be4d5871-add6-4f8d-a532-bd0e6d4c555c)
[]
{"login":"vikyw89","id":112059651,"node_id":"U_kgDOBq3lAw","avatar_url":"https://avatars.githubusercontent.com/u/112059651?v=4","gravatar_id":"","url":"https://api.github.com/users/vikyw89","html_url":"https://github.com/vikyw89","followers_url":"https://api.github.com/users/vikyw89/followers","following_url":"https://api.github.com/users/vikyw89/following{/other_user}","gists_url":"https://api.github.com/users/vikyw89/gists{/gist_id}","starred_url":"https://api.github.com/users/vikyw89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vikyw89/subscriptions","organizations_url":"https://api.github.com/users/vikyw89/orgs","repos_url":"https://api.github.com/users/vikyw89/repos","events_url":"https://api.github.com/users/vikyw89/events{/privacy}","received_events_url":"https://api.github.com/users/vikyw89/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-11T10:47:29Z
2023-11-11T10:47:29Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3866/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3866/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3866/timeline
66
https://github.com/reduxjs/redux-toolkit/issues/3858
BugRTKQ-Code-Gen[BUG] RTK-Query Codegen doesn't honour basePath from specbasePath03858
All our swagger fields define a basePath and our paths expect it to be set. Unfortunately I the codegen doesn't merge the paths together.

I can't use the basePath from baseQuery in createApi since I need to include 5 different apis, all with different basePaths .

## Solution for my use case:
Allow `ConfigFile` used in `openapi-config.ts` to define `basePath`, and _eiher_ upgrade `api.injectEndpoints` to include `basePaht`, _or_ modify all `endpint.url`s to include `basePath` from the configuration
[]
{"login":"Richard87","id":5749715,"node_id":"MDQ6VXNlcjU3NDk3MTU=","avatar_url":"https://avatars.githubusercontent.com/u/5749715?v=4","gravatar_id":"","url":"https://api.github.com/users/Richard87","html_url":"https://github.com/Richard87","followers_url":"https://api.github.com/users/Richard87/followers","following_url":"https://api.github.com/users/Richard87/following{/other_user}","gists_url":"https://api.github.com/users/Richard87/gists{/gist_id}","starred_url":"https://api.github.com/users/Richard87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Richard87/subscriptions","organizations_url":"https://api.github.com/users/Richard87/orgs","repos_url":"https://api.github.com/users/Richard87/repos","events_url":"https://api.github.com/users/Richard87/events{/privacy}","received_events_url":"https://api.github.com/users/Richard87/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-11-09T14:22:34Z
2023-11-10T13:40:00Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3858/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3858/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3858/timeline
67
https://github.com/reduxjs/redux-toolkit/issues/3857
BugRTKQ-Code-Gen`@rtk-query/codegen-openapi` missing dependenciests-node error33857
I am trying to run `@rtk-query/codegen-openapi` in my repository. Providing `openapi-config.ts` as TS file. Ends up with `Encountered a TypeScript configfile, but neither esbuild-runner nor ts-node are installed`. Both dependencies are installed tho. I am on MacOS (13.3.1 (22E261)), using zsh terminal
[]
{"login":"ondra-rejnek","id":63557306,"node_id":"MDQ6VXNlcjYzNTU3MzA2","avatar_url":"https://avatars.githubusercontent.com/u/63557306?v=4","gravatar_id":"","url":"https://api.github.com/users/ondra-rejnek","html_url":"https://github.com/ondra-rejnek","followers_url":"https://api.github.com/users/ondra-rejnek/followers","following_url":"https://api.github.com/users/ondra-rejnek/following{/other_user}","gists_url":"https://api.github.com/users/ondra-rejnek/gists{/gist_id}","starred_url":"https://api.github.com/users/ondra-rejnek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ondra-rejnek/subscriptions","organizations_url":"https://api.github.com/users/ondra-rejnek/orgs","repos_url":"https://api.github.com/users/ondra-rejnek/repos","events_url":"https://api.github.com/users/ondra-rejnek/events{/privacy}","received_events_url":"https://api.github.com/users/ondra-rejnek/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-11-08T14:53:55Z
2023-12-01T09:51:40Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3857/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3857/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3857/timeline
68
https://github.com/reduxjs/redux-toolkit/issues/3852
FeatureRTKQUpdate `<ApiProvider>` to throw an error if it's used inside of another `<Provider>`ApiProvider0
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/13","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13/labels","id":10275572,"node_id":"MI_kwDOB2ACAs4AnMr0","number":13,"title":"2.x bugfixes","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":6,"state":"open","created_at":"2023-12-06T12:49:04Z","updated_at":"2024-01-21T01:26:46Z","due_on":null,"closed_at":null}
3852
`<ApiProvider>` is _only_ meant for apps that don't already have a Redux store being created. But, we've repeatedly seen people try to use something like `<Provider store={store}><ApiProvider>`, and then wonder why the app breaks.

We should add a debug check inside of `<ApiProvider>` that checks for the existence of `const store = useStore()` (or similar), and throw an error if it finds that above, to try to help users avoid that error.
[]
{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false}
COLLABORATORopenFALSE
2023-11-07T01:57:26Z
2023-12-06T12:49:46Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3852/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3852/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3852/timeline
71
https://github.com/reduxjs/redux-toolkit/issues/3826
BugRTKQforceRefetch may lead to swallowed errorserror handlingBen has a good investigation response links to #379513826
Hi there 👋

We realized yesterday that there may be an issue with `forceRefetch` (#2663). I'm not sure if the behaviour is intended:
When there is an error within the function passed as `forceRefetch`, it will trigger a `rejected` action with an error in it, which is swallowing that error being propagated to anywhere.
I created a reproduction here: https://codesandbox.io/s/rtkquery-forcerefetch-issue-6x4zl5
You can check the console to see the hook state which is stuck in `pending` (was stuck in `uninitialized` in our work repo). And the `pokemonApi/executeQuery/rejected` action which is dispatched on the store which includes the error.

It would've saved us some debugging time if that error would've appeared in the console (without implementing a custom middleware), so I'd like to know if I should create a PR to make this error be thrown - or if implementing a middleware to report these errors is the intended way?
[]
{"login":"schadenn","id":38312007,"node_id":"MDQ6VXNlcjM4MzEyMDA3","avatar_url":"https://avatars.githubusercontent.com/u/38312007?v=4","gravatar_id":"","url":"https://api.github.com/users/schadenn","html_url":"https://github.com/schadenn","followers_url":"https://api.github.com/users/schadenn/followers","following_url":"https://api.github.com/users/schadenn/following{/other_user}","gists_url":"https://api.github.com/users/schadenn/gists{/gist_id}","starred_url":"https://api.github.com/users/schadenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schadenn/subscriptions","organizations_url":"https://api.github.com/users/schadenn/orgs","repos_url":"https://api.github.com/users/schadenn/repos","events_url":"https://api.github.com/users/schadenn/events{/privacy}","received_events_url":"https://api.github.com/users/schadenn/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-10-26T10:25:00Z
2023-10-26T10:56:15Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3826/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3826/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3826/timeline
72
https://github.com/reduxjs/redux-toolkit/issues/3823FeatureRTKQ, PerfTry to optimize `invalidationByTags.ts`invalideTags optimisation0
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3823
The logic in the `context.batch()` call inside `invalidationByTags.ts` is inefficient, because it dispatches a separate `removeQueryResult()` action for each entry. We could have a single action named `removeQueryResults` and group all those in one array, and do one dispatch.

(This _will_ cause issues with `cacheLifecycle.ts`, so this will require some careful logic consideration...)
[]
{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false}
COLLABORATORopenFALSE
2023-10-26T01:23:01Z
2023-10-29T14:55:19Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3823/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3823/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3823/timeline
73
https://github.com/reduxjs/redux-toolkit/issues/3822FeatureRTKQ-Code-GenAdd an option to encode query arguments in openApi codegenparams option13822
Hi all,

Currently, there is no way to specify that query arguments should be encoded when generating OpenAPI code using rtk query codegen. This can be a problem if you are using an argument with special characters, such as #.

For example, the following query function would result in an OpenAPI endpoint:
```
doFoo: build.mutation<void, { foo: string, ... }>({
query: (queryArg) => ({
url: `/api/${queryArg.foo}`,
method: "POST",
body: queryArg.requestObject,
}),
}),
```

To fix this, I would like to request an option to enable query argument encoding in OpenAPI codegen. This would generate the following query function and generate an encoded endpoint: **`/api/${encodeURIComponent(queryArg.foo)}`** or similar

I believe that this would be a valuable addition to rtk query openAPI codegen, as it would make it easier to use query args with special characters.

Thank you for your consideration.

Meantime I'm using `injectEndpoints` and overwriting them which is not ideal.
[]
{"login":"ifozest","id":2482297,"node_id":"MDQ6VXNlcjI0ODIyOTc=","avatar_url":"https://avatars.githubusercontent.com/u/2482297?v=4","gravatar_id":"","url":"https://api.github.com/users/ifozest","html_url":"https://github.com/ifozest","followers_url":"https://api.github.com/users/ifozest/followers","following_url":"https://api.github.com/users/ifozest/following{/other_user}","gists_url":"https://api.github.com/users/ifozest/gists{/gist_id}","starred_url":"https://api.github.com/users/ifozest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifozest/subscriptions","organizations_url":"https://api.github.com/users/ifozest/orgs","repos_url":"https://api.github.com/users/ifozest/repos","events_url":"https://api.github.com/users/ifozest/events{/privacy}","received_events_url":"https://api.github.com/users/ifozest/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-10-25T11:56:23Z
2023-11-27T14:59:17Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3822/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3822/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3822/timeline
74
https://github.com/reduxjs/redux-toolkit/issues/3816
BugDocs, RTK, RTKQAlgolia website search does not workalgolia search53816
The docs site is generally good and well written, but the Algolia search engine seems to be useless. Even for simple searches, the ranking of results makes no sense, and the titles of the results are misleading.

As an example, try searching "createAsyncThunk". This is a core RTK library function that has a single dedicated, detailed documentation page titled simply `createAsyncThunk`. I can't think of an easier case for a search engine to surface the correct page. But that page is actually buried under about 12 spurious results. To make it worse, a couple of the spurious results (including the very top result) are promisingly titled, exactly, "createAsyncThunk" - but if you click through you just get taken to an anchor on some other page that mentions `createAsyncThunk`. You might try adding "api" to the search term, but that doesn't help at all, it seems to just make the results even more random. It's the exact same story if you search for something else like `createSlice`.

Unless others are finding it useful, I'd suggest removing the Algolia search from the docs site, as for me it has just been a confusing, frustrating timewaster while learning RTK.
[]
{"login":"callumlocke","id":250617,"node_id":"MDQ6VXNlcjI1MDYxNw==","avatar_url":"https://avatars.githubusercontent.com/u/250617?v=4","gravatar_id":"","url":"https://api.github.com/users/callumlocke","html_url":"https://github.com/callumlocke","followers_url":"https://api.github.com/users/callumlocke/followers","following_url":"https://api.github.com/users/callumlocke/following{/other_user}","gists_url":"https://api.github.com/users/callumlocke/gists{/gist_id}","starred_url":"https://api.github.com/users/callumlocke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/callumlocke/subscriptions","organizations_url":"https://api.github.com/users/callumlocke/orgs","repos_url":"https://api.github.com/users/callumlocke/repos","events_url":"https://api.github.com/users/callumlocke/events{/privacy}","received_events_url":"https://api.github.com/users/callumlocke/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-10-21T14:22:39Z
2023-10-22T09:46:07Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3816/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3816/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3816/timeline
75
https://github.com/reduxjs/redux-toolkit/issues/3814
BugRTKQ-Code-Gen rtk-query-codegen-openapi: Null values not always respectedoazapfts23814
I've recently upgraded my OpenAPI schema to 3.1, and while in most places the

```
type:
- "object"
- "null"
```

style seems to generate the correct code, in other places it does not.

For example, given this:
![image](https://github.com/reduxjs/redux-toolkit/assets/5110855/89235a40-e5c2-4de5-a5eb-6a5e7a785ea5)

The generated output is:
![image](https://github.com/reduxjs/redux-toolkit/assets/5110855/881dc9cc-17aa-4863-a3ad-033e719cee91)

Where `stack` is not also nullable.

The same thing happens in various other spots, such as here in the password field of this nested object:
![image](https://github.com/reduxjs/redux-toolkit/assets/5110855/c14276b6-ff25-4842-87f6-793171d5e4f1)

The output being:
![image](https://github.com/reduxjs/redux-toolkit/assets/5110855/526b9924-fd60-46a9-85a6-285e6962326e)

It appears to generate correctly in circumstances such as this:
![image](https://github.com/reduxjs/redux-toolkit/assets/5110855/de69a6bd-4dcc-41de-9e41-dd0aeca3eb48)

Where I use an anyOf to reference another type that can also be null in this field, the generated being:
![image](https://github.com/reduxjs/redux-toolkit/assets/5110855/f12cfcb9-4275-4c37-ba7c-f241e69b3d0b)

It appears that the generator doesn't work correctly when you have a type with multiple values, and one of them is `null`. I think the codegen should support this since it is the recommended way to handle nullable values in the OpenAPI spec.
[]
{"login":"mattoni","id":5110855,"node_id":"MDQ6VXNlcjUxMTA4NTU=","avatar_url":"https://avatars.githubusercontent.com/u/5110855?v=4","gravatar_id":"","url":"https://api.github.com/users/mattoni","html_url":"https://github.com/mattoni","followers_url":"https://api.github.com/users/mattoni/followers","following_url":"https://api.github.com/users/mattoni/following{/other_user}","gists_url":"https://api.github.com/users/mattoni/gists{/gist_id}","starred_url":"https://api.github.com/users/mattoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattoni/subscriptions","organizations_url":"https://api.github.com/users/mattoni/orgs","repos_url":"https://api.github.com/users/mattoni/repos","events_url":"https://api.github.com/users/mattoni/events{/privacy}","received_events_url":"https://api.github.com/users/mattoni/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-10-19T20:19:17Z
2023-10-20T18:14:14Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3814/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3814/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3814/timeline
76
https://github.com/reduxjs/redux-toolkit/issues/3801
FeatureDocs, RTKQReview, define, and document RTKQ intended timing behavior and invariantstiming behaviors0
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3801
I think one of our biggest issues atm is that we don't have actual documented specifications and intent for how RTKQ should behave with timing-related aspects. We've got code, and we've got a decent amount of tests, but there isn't anything written down that says "here's what we _intend_ this to do".

Areas I'm thinking about:

- Timing of queries, mutations, and invalidations
- All the logic around returning promises from thunks and when those resolve
- ????

I think we need to take some time to document the _current_ behavior, and then discuss what we _want_ to have happen.

It would probably help to write out a number of use cases (such as some of the ones described in #2203 and #3105 ), and decide at a high level how we'd want to handle them.

We should also review the cache lifecycles behavior as well, like how they don't run if there's a cache hit (and what might make sense in that case).
[]
{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false}
COLLABORATORopenFALSE
2023-10-14T16:44:55Z
2023-10-14T16:55:44Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3801/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3801/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3801/timeline
77
https://github.com/reduxjs/redux-toolkit/issues/3797FeatureRTKQ-Code-Gen[RTK Query Codegen OpenAPI] authorization header when generatingswagger-options83797
Our team's backend OpenAPI docs, and subsequently the schema file, are authorization dependent. In other words, depending on the level of authorization you have, portions of the schema file are not visible. Our authorization token is sent in the header.

When using codegen, RTK Query does not fetch the OpenAPI JSON from our backend server with the provided tokens from `prepareHeaders` argument in the `fetchBaseQuery` function when creating an API with `createApi`. Since no token is provided, only a handful of endpoints are generated.

How can we provide an authorization token when generating code from a remote OpenAPI JSON schema file?
[]
{"login":"Harry-Dang","id":36112469,"node_id":"MDQ6VXNlcjM2MTEyNDY5","avatar_url":"https://avatars.githubusercontent.com/u/36112469?v=4","gravatar_id":"","url":"https://api.github.com/users/Harry-Dang","html_url":"https://github.com/Harry-Dang","followers_url":"https://api.github.com/users/Harry-Dang/followers","following_url":"https://api.github.com/users/Harry-Dang/following{/other_user}","gists_url":"https://api.github.com/users/Harry-Dang/gists{/gist_id}","starred_url":"https://api.github.com/users/Harry-Dang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harry-Dang/subscriptions","organizations_url":"https://api.github.com/users/Harry-Dang/orgs","repos_url":"https://api.github.com/users/Harry-Dang/repos","events_url":"https://api.github.com/users/Harry-Dang/events{/privacy}","received_events_url":"https://api.github.com/users/Harry-Dang/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-10-12T21:14:29Z
2023-10-12T22:19:45Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3797/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3797/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3797/timeline
78
https://github.com/reduxjs/redux-toolkit/issues/3795
Bug, DiscussionRTKQRTK Query gets stuck pending and swallows errors thrown in addMatcher reducerserror handlingmentioned by #3826193795
I just ran into this problem and found [this](https://github.com/reduxjs/redux-toolkit/issues/1376#issuecomment-1361617034) comment saying it's expected behavior, but I'm making this issue with a clearer example for further discussion because this seems like a footgun that should be changed.

Below is an example with a login button. Click the button and it sends a POST request to the backend with credentials to log in and gets back user info + token, and stores them in the authSlice and displays the username.

https://codesandbox.io/p/github/adamerose/rtkq-reducer-error-example/master
https://github.com/adamerose/rtkq-reducer-error-example

With the error thrown in the matchFulfilled reducer, the query gets stuck forever in this state even though the HTTP request completed successfully:
```
isUninitialized:false
isFetching:true
isSuccess:false
isError:false
```
```typescript
const authSlice = createSlice({
name: "auth",
initialState: initialState,
reducers: {
logout: (state) => {
state.user = null
},
},
extraReducers: (builder) => {
builder.addMatcher(
api.endpoints.login.matchFulfilled,
(state, { payload }) => {
state.user = payload.user

throw Error("Example error")
},
)
},
})
```


It also seems to completely swallow the error and nothing appears in the console, which made it very hard to figure out why I was getting stuck pending in an actual project. I've included a separate Throw Error button that throws an error in a normal reducer and I can see it appear in the console, but for some reason the one inside the addMatcher example doesn't. Am I doing something wrong here?

<img width="639" alt="image" src="https://github.com/reduxjs/redux-toolkit/assets/10884874/2690ec31-9984-40c9-b3c3-c7852097bafe">

<img width="632" alt="image" src="https://github.com/reduxjs/redux-toolkit/assets/10884874/f157f79c-c2ff-4125-bc89-0ef87c58a973">

<img width="573" alt="image" src="https://github.com/reduxjs/redux-toolkit/assets/10884874/158fb2ba-2953-4c19-98e1-50d9e7058716">
[]
{"login":"adamerose","id":10884874,"node_id":"MDQ6VXNlcjEwODg0ODc0","avatar_url":"https://avatars.githubusercontent.com/u/10884874?v=4","gravatar_id":"","url":"https://api.github.com/users/adamerose","html_url":"https://github.com/adamerose","followers_url":"https://api.github.com/users/adamerose/followers","following_url":"https://api.github.com/users/adamerose/following{/other_user}","gists_url":"https://api.github.com/users/adamerose/gists{/gist_id}","starred_url":"https://api.github.com/users/adamerose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamerose/subscriptions","organizations_url":"https://api.github.com/users/adamerose/orgs","repos_url":"https://api.github.com/users/adamerose/repos","events_url":"https://api.github.com/users/adamerose/events{/privacy}","received_events_url":"https://api.github.com/users/adamerose/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-10-11T21:30:29Z
2023-12-07T20:35:52Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3795/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3795/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3795/timeline
reopened
79
https://github.com/reduxjs/redux-toolkit/issues/3792BugRTKQ-Code-Gen@rtk-query/codegen triggers ERR_REQUIRE_ESM when using prettier with pluginsprettier v333792
When using the **prettier-plugin-jsdoc** (current latest version 1.1.1) in my **.prettierrc** as such:
```
"plugins": [
"prettier-plugin-jsdoc"
],
```

and running ```npx @rtk-query/codegen-openapi ./api.config.ts``` I get the following error:
```
Error [ERR_REQUIRE_ESM]: require() of ES Module <projectRoot>\node_modules\prettier-plugin-jsdoc\dist\index.js from <projectRoot>\node_modules\@rtk-query\codegen-openapi\node_modules\prettier\index.js not supported.
Instead change the require of <projectRoot>\node_modules\prettier-plugin-jsdoc\dist\index.js in <projectRoot>\node_modules\@rtk-query\codegen-openapi\node_modules\prettier\index.js to a dynamic import() which is available in all CommonJS modules.
at require.extensions.<computed> [as .js] (<projectRoot>\node_modules\ts-node\dist\index.js:851:20)
at <projectRoot>\node_modules\@rtk-query\codegen-openapi\node_modules\prettier\index.js:38143:10
at Array.map (<anonymous>)
at Object.load (<projectRoot>\node_modules\@rtk-query\codegen-openapi\node_modules\prettier\index.js:38141:128)
at Object.load [as loadPlugins] (<projectRoot>\node_modules\@rtk-query\codegen-openapi\node_modules\prettier\index.js:16147:23)
at <projectRoot>\node_modules\@rtk-query\codegen-openapi\node_modules\prettier\index.js:38181:24
at Object.format (<projectRoot>\node_modules\@rtk-query\codegen-openapi\node_modules\prettier\index.js:38197:12)
at prettify (<projectRoot>\node_modules\@rtk-query\codegen-openapi\lib\utils\prettier.js:57:21)
at async generateEndpoints (<projectRoot>\node_modules\@rtk-query\codegen-openapi\lib\index.js:21:87)
at async run (<projectRoot>\node_modules\@rtk-query\codegen-openapi\lib\bin\cli.js:54:13) {
code: 'ERR_REQUIRE_ESM'
}
```

The code generator correctly uses prettier to dynamically import the plugin but it uses ```require``` and thus produces the error in runtime. There might be other configurations in the project's context that cause this error but when I remove the plugin in **.prettierrc** the command runs without error. I assume any other prettier plugins will also result in the same issue.

Is there any change to the TS Node context or prettier utils that could alleviate this issue?
[]
{"login":"vmmitev","id":1255804,"node_id":"MDQ6VXNlcjEyNTU4MDQ=","avatar_url":"https://avatars.githubusercontent.com/u/1255804?v=4","gravatar_id":"","url":"https://api.github.com/users/vmmitev","html_url":"https://github.com/vmmitev","followers_url":"https://api.github.com/users/vmmitev/followers","following_url":"https://api.github.com/users/vmmitev/following{/other_user}","gists_url":"https://api.github.com/users/vmmitev/gists{/gist_id}","starred_url":"https://api.github.com/users/vmmitev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmmitev/subscriptions","organizations_url":"https://api.github.com/users/vmmitev/orgs","repos_url":"https://api.github.com/users/vmmitev/repos","events_url":"https://api.github.com/users/vmmitev/events{/privacy}","received_events_url":"https://api.github.com/users/vmmitev/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-10-11T09:59:58Z
2023-10-15T08:44:28Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3792/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3792/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3792/timeline
80
https://github.com/reduxjs/redux-toolkit/issues/3789
FeatureRTKQReturn `meta` from `retry.fail()`Retry, error handling03789
Currently, if you use `retry` with `fetchBaseQuery()`, and you bail out early (eg, because of a 4xx status), then the result is missing `meta` data.

The code for `fail` is:

```typescript
function fail(e: any): never {
throw Object.assign(new HandledError({ error: e }), {
throwImmediately: true,
})
}
```

So `retry.fail()` is only returning / throwing the error, and not returning the meta, although `HandledError` is capable of handling meta:

```typescript
export class HandledError {
constructor(
public readonly value: any,
public readonly meta: any = undefined
) {}
}
```
[]
{"login":"denchen","id":2073768,"node_id":"MDQ6VXNlcjIwNzM3Njg=","avatar_url":"https://avatars.githubusercontent.com/u/2073768?v=4","gravatar_id":"","url":"https://api.github.com/users/denchen","html_url":"https://github.com/denchen","followers_url":"https://api.github.com/users/denchen/followers","following_url":"https://api.github.com/users/denchen/following{/other_user}","gists_url":"https://api.github.com/users/denchen/gists{/gist_id}","starred_url":"https://api.github.com/users/denchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denchen/subscriptions","organizations_url":"https://api.github.com/users/denchen/orgs","repos_url":"https://api.github.com/users/denchen/repos","events_url":"https://api.github.com/users/denchen/events{/privacy}","received_events_url":"https://api.github.com/users/denchen/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-10-10T23:51:38Z
2023-10-10T23:51:38Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3789/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3789/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3789/timeline
81
https://github.com/reduxjs/redux-toolkit/issues/3778BugRTKQ[RTK-Query]: `useQuery` hook does not refetch after `resetApiState` (2)resetApiStatebreaking?3
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/13","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13/labels","id":10275572,"node_id":"MI_kwDOB2ACAs4AnMr0","number":13,"title":"2.x bugfixes","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":6,"state":"open","created_at":"2023-12-06T12:49:04Z","updated_at":"2024-01-21T01:26:46Z","due_on":null,"closed_at":null}
3778
### Description:
This issue appears to be a bug in RTK-Query, which should have been resolved by #1735 and #3333. However, it appears that the problem persists.

### Reproduction Steps:
1. Access the following example showcasing the issue: [CodeSandbox](https://codesandbox.io/s/rtkq-resetapistate-query-2mxs7f)
2. Click on the "Rerender Component" button.
3. Click on the "Reset Api State" button.

### Expected Behavior:
After clicking "Reset API State," the request should not remain stuck in a pending status. Instead, it should automatically re-fetch the query. Currently, the request remains pending until the component is re-rendered. Even if we attempt to manually refetch, the query is executed, but the result remains pending.
[{"id":855085600,"node_id":"MDU6TGFiZWw4NTUwODU2MDA=","url":"https://api.github.com/repos/reduxjs/redux-toolkit/labels/bug","name":"bug","color":"d73a4a","default":true,"description":"Something isn't working"}]
{"login":"manceauJb","id":62114245,"node_id":"MDQ6VXNlcjYyMTE0MjQ1","avatar_url":"https://avatars.githubusercontent.com/u/62114245?v=4","gravatar_id":"","url":"https://api.github.com/users/manceauJb","html_url":"https://github.com/manceauJb","followers_url":"https://api.github.com/users/manceauJb/followers","following_url":"https://api.github.com/users/manceauJb/following{/other_user}","gists_url":"https://api.github.com/users/manceauJb/gists{/gist_id}","starred_url":"https://api.github.com/users/manceauJb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manceauJb/subscriptions","organizations_url":"https://api.github.com/users/manceauJb/orgs","repos_url":"https://api.github.com/users/manceauJb/repos","events_url":"https://api.github.com/users/manceauJb/events{/privacy}","received_events_url":"https://api.github.com/users/manceauJb/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-10-05T07:01:32Z
2023-12-06T12:49:45Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3778/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3778/reactions","total_count":2,"+1":2,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3778/timeline
83
https://github.com/reduxjs/redux-toolkit/issues/3765
BugRTKQ-Code-Genrtk-query-codegen-openapi has stopped working. oazapfts13765
I ran test with the following command and got an error. 😢
I tried yarn versions 2~4, but I couldn't figure it out.
Do you know what could be the cause?
I'm not sure when I last ran it, but I think it happened after `rm -rf node_modules` and then `yarn install` again. 😭

```sh
$ cd redux-toolkit/packages/rtk-query-codegen-openapi
$ yarn install
$ yarn test
FAIL test/cli.test.ts (8.155 s)
● CLI options testing › generation with `config.example.js`

expect(received).toEqual(expected) // deep equality

- Expected - 3
+ Received + 21

Object {
- "error": null,
- "stderr": "",
+ "error": Error {
+ "cmd": "/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/node_modules/ts-node/dist/bin.js -T -P /Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/tsconfig.json /Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/bin/cli.ts ./config.example.js",
+ "code": 1,
+ "killed": false,
+ "signal": null,
+ },
+ "stderr": "DeprecationWarning: 'createTypeAliasDeclaration' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.
+ DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.8.0. Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter.
+ DeprecationWarning: 'createIndexSignature' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.
+ TypeError: Cannot read properties of undefined (reading 'length')
+ at emitUnparsedSourceOrPrepend (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90429:61)
+ at pipelineEmitWithHintWorker (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90150:24)
+ at pipelineEmitWithHint (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89898:13)
+ at pipelineEmitWithComments (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:93061:11)
+ at pipelineEmit (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89847:11)
+ at emit (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89820:11)
+ at emitNodeList (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:92443:17)
+ at emitList (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:92349:11)
+ at emitObjectLiteralExpression (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90863:11)
+ at pipelineEmitWithHintWorker (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90254:24)
+ ",
"stdout": "Generating ./tmp/example.ts
- Done
",
}

36 | const out = await cli([`./config.example.js`], __dirname);
37 |
> 38 | expect(out).toEqual({
| ^
39 | stdout: `Generating ./tmp/example.ts
40 | Done
41 | `,

at Object.<anonymous> (cli.test.ts:38:17)

● CLI options testing › paths are relative to configfile, not to cwd

expect(received).toEqual(expected) // deep equality

- Expected - 3
+ Received + 21

Object {
- "error": null,
- "stderr": "",
+ "error": Error {
+ "cmd": "/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/node_modules/ts-node/dist/bin.js -T -P /Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/tsconfig.json /Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/bin/cli.ts ../test/config.example.js",
+ "code": 1,
+ "killed": false,
+ "signal": null,
+ },
+ "stderr": "DeprecationWarning: 'createTypeAliasDeclaration' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.
+ DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.8.0. Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter.
+ DeprecationWarning: 'createIndexSignature' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.
+ TypeError: Cannot read properties of undefined (reading 'length')
+ at emitUnparsedSourceOrPrepend (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90429:61)
+ at pipelineEmitWithHintWorker (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90150:24)
+ at pipelineEmitWithHint (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89898:13)
+ at pipelineEmitWithComments (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:93061:11)
+ at pipelineEmit (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89847:11)
+ at emit (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89820:11)
+ at emitNodeList (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:92443:17)
+ at emitList (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:92349:11)
+ at emitObjectLiteralExpression (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90863:11)
+ at pipelineEmitWithHintWorker (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90254:24)
+ ",
"stdout": "Generating ./tmp/example.ts
- Done
",
}

50 | const out = await cli([`../test/config.example.js`], path.resolve(__dirname, '../src'));
51 |
> 52 | expect(out).toEqual({
| ^
53 | stdout: `Generating ./tmp/example.ts
54 | Done
55 | `,

at Object.<anonymous> (cli.test.ts:52:17)

● CLI options testing › ts, js and json all work the same

ENOENT: no such file or directory, open '/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/test/tmp/example.ts'

63 | test('ts, js and json all work the same', async () => {
64 | await cli([`./config.example.js`], __dirname);
> 65 | const fromJs = fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8');
| ^
66 | await cli([`./config.example.ts`], __dirname);
67 | const fromTs = fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8');
68 | await cli([`./config.example.json`], __dirname);

at Object.<anonymous> (cli.test.ts:65:23)

FAIL test/generateEndpoints.test.ts
● Console

console.warn
DeprecationWarning: 'createTypeAliasDeclaration' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.

222 | code,
223 | apiGen.resolve(response),
> 224 | apiGen.getTypeFromResponse(response) || factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),
| ^
225 | ] as const
226 | )
227 | .filter(([status, response]) => isDataResponse(status, apiGen.resolve(response), responses || {}))

at Object.log (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:174493:62)
at logMessage (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2502:35)
at Function.warn (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2515:17)
at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3116:25
at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3137:17
at Object.createTypeAliasDeclaration (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:172142:27)
at Object.createTypeAliasDeclaration (../node_modules/@rtk-query/oazapfts-patched/src/codegen/tscodegen.ts:75:18)
at ApiGenerator.getRefAlias (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:261:12)
at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:361:19)
at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
at ../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:446:23
at Array.map (<anonymous>)
at ApiGenerator.getTypeFromProperties (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:443:58)
at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:394:19)
at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
at ApiGenerator.getRefAlias (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:259:25)
at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:361:19)
at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
at ApiGenerator.getTypeFromResponse (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:501:17)
at map (../src/generate.ts:224:22)
at Array.map (<anonymous>)
at generateEndpoint (../src/generate.ts:219:10)
at map (../src/generate.ts:144:15)
at Array.map (<anonymous>)
at generateApi (../src/generate.ts:143:34)
at generateEndpoints (../src/index.ts:14:22)
at Object.<anonymous> (generateEndpoints.test.ts:18:15)

console.warn
DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.8.0. Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter.

222 | code,
223 | apiGen.resolve(response),
> 224 | apiGen.getTypeFromResponse(response) || factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),
| ^
225 | ] as const
226 | )
227 | .filter(([status, response]) => isDataResponse(status, apiGen.resolve(response), responses || {}))

at Object.log (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:174493:62)
at logMessage (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2502:35)
at Function.warn (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2515:17)
at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3116:25
at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3137:17
at Object.createParameterDeclaration (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:172142:27)
at createParameter (../node_modules/@rtk-query/oazapfts-patched/src/codegen/tscodegen.ts:295:18)
at Object.createIndexSignature (../node_modules/@rtk-query/oazapfts-patched/src/codegen/tscodegen.ts:351:6)
at ApiGenerator.getTypeFromProperties (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:462:23)
at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:394:19)
at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
at ApiGenerator.getTypeFromResponse (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:501:17)
at map (../src/generate.ts:224:22)
at Array.map (<anonymous>)
at generateEndpoint (../src/generate.ts:219:10)
at map (../src/generate.ts:144:15)
at Array.map (<anonymous>)
at generateApi (../src/generate.ts:143:34)
at generateEndpoints (../src/index.ts:14:22)
at Object.<anonymous> (generateEndpoints.test.ts:18:15)

console.warn
DeprecationWarning: 'createIndexSignature' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.

222 | code,
223 | apiGen.resolve(response),
> 224 | apiGen.getTypeFromResponse(response) || factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),
| ^
225 | ] as const
226 | )
227 | .filter(([status, response]) => isDataResponse(status, apiGen.resolve(response), responses || {}))

at Object.log (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:174493:62)
at logMessage (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2502:35)
at Function.warn (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2515:17)
at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3116:25
at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3137:17
at Object.createIndexSignature (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:172142:27)
at Object.createIndexSignature (../node_modules/@rtk-query/oazapfts-patched/src/codegen/tscodegen.ts:348:18)
at ApiGenerator.getTypeFromProperties (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:462:23)
at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:394:19)
at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
at ApiGenerator.getTypeFromResponse (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:501:17)
at map (../src/generate.ts:224:22)
at Array.map (<anonymous>)
at generateEndpoint (../src/generate.ts:219:10)
at map (../src/generate.ts:144:15)
at Array.map (<anonymous>)
at generateApi (../src/generate.ts:143:34)
at generateEndpoints (../src/index.ts:14:22)
at Object.<anonymous> (generateEndpoints.test.ts:18:15)

● calling without `outputFile` returns the generated api

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● endpoint filtering

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● endpoint filtering by function

TypeError: Cannot read properties of undefined (reading 'end')

at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

● negated endpoint filtering

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● endpoint overrides

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● option flattenArg › should apply a queryArg directly in the path

TypeError: Cannot read properties of undefined (reading 'end')

at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

● option flattenArg › should apply a queryArg directly in the params

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● option flattenArg › should use the queryArg as the entire body

TypeError: Cannot read properties of undefined (reading 'end')

at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

● option flattenArg › should not change anything if there are 2+ arguments.

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● hooks generation

TypeError: Cannot read properties of undefined (reading 'end')

at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

● supports granular hooks generation that includes all query types

TypeError: Cannot read properties of undefined (reading 'end')

at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

● supports granular hooks generation with only queries

TypeError: Cannot read properties of undefined (reading 'end')

at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

● supports granular hooks generation with only lazy queries

TypeError: Cannot read properties of undefined (reading 'end')

at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

● supports granular hooks generation with only mutations

TypeError: Cannot read properties of undefined (reading 'end')

at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

● hooks generation uses overrides

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● should use brackets in a querystring urls arg, when the arg contains full stops

expect(received).toMatchSnapshot()

Snapshot name: `should use brackets in a querystring urls arg, when the arg contains full stops 1`

- Snapshot - 2
+ Received + 2

@@ -9,10 +9,10 @@
}),
}),
overrideExisting: false,
});
export { injectedRtkApi as enhancedApi };
- export type PatchApiV1ListByItemIdApiResponse = /** status 200 A successful response. */ string;
+ export type PatchApiV1ListByItemIdApiResponse = /** status 200 A successful response. */ undefined;
export type PatchApiV1ListByItemIdApiArg = {
- 'item.id': string;
+ 'item.id': undefined;
};


227 | // eslint-disable-next-line no-template-curly-in-string
228 | expect(api).toContain('`/api/v1/list/${queryArg["item.id"]}`');
> 229 | expect(api).toMatchSnapshot();
| ^
230 | });
231 |
232 | test('apiImport builds correct `import` statement', async () => {

at Object.<anonymous> (generateEndpoints.test.ts:229:15)

● yaml parsing › should parse a yaml schema from a URL

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● yaml parsing › should be able to use read a yaml file

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● yaml parsing › should generate params with non quoted keys if they don't contain special characters

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● yaml parsing › should generate params with quoted keys if they contain special characters

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

● tests from issues › issue #2002: should be able to generate proper intersection types

TypeError: Cannot read properties of undefined (reading 'length')

at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
at emit (../node_modules/typescript/lib/typescript.js:108499:13)
at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

› 1 snapshot failed.
› 4 snapshots obsolete.
• endpoint filtering: should only have endpoints loginUser, placeOrder, getOrderById, deleteOrder 1
• endpoint overrides: loginUser should be a mutation 1
• hooks generation uses overrides: should generate an `useLoginMutation` mutation hook 1
• hooks generation: should generate an `useGetPetByIdQuery` query hook and an `useAddPetMutation` mutation hook 1
Snapshot Summary
› 1 snapshot failed from 1 test suite. Inspect your code changes or re-run jest with `-u` to update them.
› 4 snapshots obsolete from 1 test suite. To remove them all, re-run jest with `-u`.
↳ ./generateEndpoints.test.ts
• endpoint filtering: should only have endpoints loginUser, placeOrder, getOrderById, deleteOrder 1
• endpoint overrides: loginUser should be a mutation 1
• hooks generation uses overrides: should generate an `useLoginMutation` mutation hook 1
• hooks generation: should generate an `useGetPetByIdQuery` query hook and an `useAddPetMutation` mutation hook 1

Test Suites: 2 failed, 2 total
Tests: 24 failed, 4 passed, 28 total
Snapshots: 1 failed, 4 obsolete, 1 total
Time: 9.232 s
Ran all test suites.
```

```
$ git log
commit 52ab548c55198f2c5cacb2be9a8dbae235d4443c (HEAD -> master, origin/master, origin/HEAD, k8s-client-api-test)
Merge: e351a09a 0d054809
Author: Mark Erikson <mark@isquaredsoftware.com>
Date: Wed Sep 27 23:46:06 2023 -0400

Merge pull request #3754 from jgabuya/patch-1
```

```
$ yarn tsc -v
Version 4.5.5
```
[]
{"login":"kahirokunn","id":22343391,"node_id":"MDQ6VXNlcjIyMzQzMzkx","avatar_url":"https://avatars.githubusercontent.com/u/22343391?v=4","gravatar_id":"","url":"https://api.github.com/users/kahirokunn","html_url":"https://github.com/kahirokunn","followers_url":"https://api.github.com/users/kahirokunn/followers","following_url":"https://api.github.com/users/kahirokunn/following{/other_user}","gists_url":"https://api.github.com/users/kahirokunn/gists{/gist_id}","starred_url":"https://api.github.com/users/kahirokunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kahirokunn/subscriptions","organizations_url":"https://api.github.com/users/kahirokunn/orgs","repos_url":"https://api.github.com/users/kahirokunn/repos","events_url":"https://api.github.com/users/kahirokunn/events{/privacy}","received_events_url":"https://api.github.com/users/kahirokunn/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-10-02T09:42:40Z
2023-10-03T04:53:04Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3765/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3765/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3765/timeline
84
https://github.com/reduxjs/redux-toolkit/issues/3733
Question, Discussion
RTKQ[question] - invalidate a result in cache when using "merge"cache invalidation193733
**Description**

I am trying to understand the right approach. Can you please give me an advice?

I am using a `query` enpoint with `merge` feature to "paginate" and keep all the results rendered on the page (clicking "next page" will display more results under those already displayed).
I use the `merge` functionality to group all results together (along with `forceRefetch` and `serializeQueryArgs`). Which works. Now I want to be able to "remove" one of the results. Invalidating the cache (using `invalidateTags` or even calling `api.utils.invalidateTags` doesn't have the desired effect. While the query IS triggered, the cache is NOT updated and the deleted result is still displayed.

In https://redux-toolkit.js.org/rtk-query/api/createApi#merge, I read: "no automatic structural sharing will be applied - it's up to you to update the cache appropriately"

What's the recommended way of achieving it? Reading the docs, I don't see a way to achieve that. Read some SO answers about using `entityAdapter` or using `prevPage`, `currentPage` and `nextPage`, but it just sounds too complicated approach for such a simple functionality I am trying to achieve = delete a single result from the cache, identified by it's ID

**My expectation**
(sort of what I thought would happen) I assumed the result would be invalidated the moment I define
```
invalidateTags: ({id}) => [{type: "Result", id }] // just illustrates what I mean
```

Seems, when I opt for using `merge`, this feature gets skipped
[]
{"login":"koukalp","id":41000441,"node_id":"MDQ6VXNlcjQxMDAwNDQx","avatar_url":"https://avatars.githubusercontent.com/u/41000441?v=4","gravatar_id":"","url":"https://api.github.com/users/koukalp","html_url":"https://github.com/koukalp","followers_url":"https://api.github.com/users/koukalp/followers","following_url":"https://api.github.com/users/koukalp/following{/other_user}","gists_url":"https://api.github.com/users/koukalp/gists{/gist_id}","starred_url":"https://api.github.com/users/koukalp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koukalp/subscriptions","organizations_url":"https://api.github.com/users/koukalp/orgs","repos_url":"https://api.github.com/users/koukalp/repos","events_url":"https://api.github.com/users/koukalp/events{/privacy}","received_events_url":"https://api.github.com/users/koukalp/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-21T12:35:10Z
2024-01-16T21:45:03Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3733/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3733/reactions","total_count":4,"+1":4,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3733/timeline
85
https://github.com/reduxjs/redux-toolkit/issues/3724QuestionRTKQ-Code-Gen@rtk-query/codegen groups names into objectsgroups names into objectslinks to #364013724
If I have an OpenAPI definition such as this:
```json
"get" : {
"description" : "Search over beneficiary collection",
"operationId" : "getBeneficiaries",
"parameters" : [ {
"in" : "query",
"name" : "filter[name]",
"schema" : {
"type" : "string"
}
}, {
"in" : "query",
"name" : "filter[customerAccount]",
"schema" : {
"items" : {
"$ref" : "#/components/schemas/CustomerAccount.uuid"
},
"type" : "array",
"uniqueItems" : true
}
}, {
"in" : "query",
"name" : "filter[currency]",
"schema" : {
"items" : {
"$ref" : "#/components/schemas/Currency.code"
},
"type" : "array",
"uniqueItems" : true
}
}, {
"in" : "query",
"name" : "page[cursor]",
"schema" : {
"type" : "string"
}
}, {
"in" : "query",
"name" : "page[size]",
"schema" : {
"default" : 200,
"format" : "int32",
"maximum" : 300,
"minimum" : 1,
"type" : "integer"
}
} ],
```
The resulting type is:
```typescript
export type GetBeneficiariesApiArg = {
filter?: {
name?: string;
customerAccount?: UuidOfACustomerAccount[];
currency?: CurrencySymbol[];
};
page?: {
cursor?: string;
size?: number;
};
};
```
Whereas I just want the names as separate params, as defined in the OpenAPI doc:
```typescript
export type GetBeneficiariesApiArg = {
'filter[name]'?: string;
'filter[customerAccount]'?: UuidOfACustomerAccount[];
'filter[currency]'?: CurrencySymbol[];
'page[cursor]'?: string;
'page[size]'?: number;
};
```
I think this is a bug, because when I use the endpoints as specified by the types, the resulting network request is:
![image](https://github.com/reduxjs/redux-toolkit/assets/9912830/49958e02-e33e-4622-a4a0-64b0bae513ba)

Why is this the case? I tried the `flattenArg` config option (not sure what it's supposed to do) but it didn't change anything. Is there a config for this, and I'm curious why names are parsed this way in general? Thanks 🙏
[]
{"login":"Onurfesci","id":9912830,"node_id":"MDQ6VXNlcjk5MTI4MzA=","avatar_url":"https://avatars.githubusercontent.com/u/9912830?v=4","gravatar_id":"","url":"https://api.github.com/users/Onurfesci","html_url":"https://github.com/Onurfesci","followers_url":"https://api.github.com/users/Onurfesci/followers","following_url":"https://api.github.com/users/Onurfesci/following{/other_user}","gists_url":"https://api.github.com/users/Onurfesci/gists{/gist_id}","starred_url":"https://api.github.com/users/Onurfesci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Onurfesci/subscriptions","organizations_url":"https://api.github.com/users/Onurfesci/orgs","repos_url":"https://api.github.com/users/Onurfesci/repos","events_url":"https://api.github.com/users/Onurfesci/events{/privacy}","received_events_url":"https://api.github.com/users/Onurfesci/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-15T11:10:16Z
2023-12-04T06:01:03Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3724/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3724/reactions","total_count":2,"+1":2,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3724/timeline
86
https://github.com/reduxjs/redux-toolkit/issues/3721BugRTKQ-Code-Gen@rtk-query/codegen ignores application/vnd.api+json contentcontent type issue - application/vnd.api+json13721
If I have a JSON:API OpenAPI spec that has `application/vnd.api+json` content type in the response, it is ignored by the codegen and the resulting response type is `unknown`.

For example:
```json
"200" : {
"content" : {
"application/vnd.api+json" : {
"schema" : {
"$ref" : "#/components/schemas/UserProfile"
}
}
},
"description" : "Result of performing a successful operation"
},
```
results in:
```typescript
export type GetUserProfileApiResponse = unknown;
```

Could `application/vnd.api+json` be parsed as a valid content type?
[]
{"login":"Onurfesci","id":9912830,"node_id":"MDQ6VXNlcjk5MTI4MzA=","avatar_url":"https://avatars.githubusercontent.com/u/9912830?v=4","gravatar_id":"","url":"https://api.github.com/users/Onurfesci","html_url":"https://github.com/Onurfesci","followers_url":"https://api.github.com/users/Onurfesci/followers","following_url":"https://api.github.com/users/Onurfesci/following{/other_user}","gists_url":"https://api.github.com/users/Onurfesci/gists{/gist_id}","starred_url":"https://api.github.com/users/Onurfesci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Onurfesci/subscriptions","organizations_url":"https://api.github.com/users/Onurfesci/orgs","repos_url":"https://api.github.com/users/Onurfesci/repos","events_url":"https://api.github.com/users/Onurfesci/events{/privacy}","received_events_url":"https://api.github.com/users/Onurfesci/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-13T21:58:05Z
2023-09-14T08:32:01Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3721/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3721/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3721/timeline
87
https://github.com/reduxjs/redux-toolkit/issues/3717BugDocs, RTKQ, ExamplePreventing multiple unauthorized errorsRetry, Auth example issues23717
I have implemented the reauthorization process with RTK Query following the docs:

This is api.ts a single createApi instance in the app:

```javascript
import { createApi } from '@reduxjs/toolkit/query/react';

import { baseQueryWithReauth } from './utils';

export const api = createApi({
reducerPath: 'api',
baseQuery: baseQueryWithReauth,
endpoints: (builder) => ({}),
});
```

And this is what i followed, the only thing that differs is
```javascript
import { fetchBaseQuery } from '@reduxjs/toolkit/query'
import type {
BaseQueryFn,
FetchArgs,
FetchBaseQueryError,
} from '@reduxjs/toolkit/query'
import { tokenReceived, loggedOut } from './authSlice'
import { Mutex } from 'async-mutex'

// create a new mutex
const mutex = new Mutex();
const baseQuery =
fetchBaseQuery({
baseUrl: `${process.env.BASE_URL}`,
prepareHeaders: (headers: Headers) => generateHeadersIfAny(headers),
}),

const baseQueryWithReauth: BaseQueryFn<
string | FetchArgs,
unknown,
FetchBaseQueryError
> = async (args, api, extraOptions) => {
// wait until the mutex is available without locking it
await mutex.waitForUnlock()
let result = await baseQuery(args, api, extraOptions)
if (result.error && result.error.status === 401) {
// checking whether the mutex is locked
if (!mutex.isLocked()) {
const release = await mutex.acquire()
try {
const refreshResult = await baseQuery(
'/get-new-tokens',
api,
extraOptions
)
if (refreshResult.data) {
api.dispatch(tokenReceived(refreshResult.data))
// retry the initial query
result = await baseQuery(args, api, extraOptions)
} else {
api.dispatch(loggedOut())
}
} finally {
// release must be called once the mutex should be released again.
release()
}
} else {
// wait until the mutex is available without locking it
await mutex.waitForUnlock()
result = await baseQuery(args, api, extraOptions)
}
}
return result
}
```

And this example works perfectly when refresh token did not expire and your refetch route returns 200 and new tokens, but the problem is when your refresh route returns 401 or 400 it goes in the else of if/else but it reruns all the requests that got 401. It's like it only works in the most optimistic case. I would like if my get-new-tokens route returns 400 or 401 don't rerun any of the multiple requests you have in mutex.
[]
{"login":"nm-ivanbasic","id":88370560,"node_id":"MDQ6VXNlcjg4MzcwNTYw","avatar_url":"https://avatars.githubusercontent.com/u/88370560?v=4","gravatar_id":"","url":"https://api.github.com/users/nm-ivanbasic","html_url":"https://github.com/nm-ivanbasic","followers_url":"https://api.github.com/users/nm-ivanbasic/followers","following_url":"https://api.github.com/users/nm-ivanbasic/following{/other_user}","gists_url":"https://api.github.com/users/nm-ivanbasic/gists{/gist_id}","starred_url":"https://api.github.com/users/nm-ivanbasic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nm-ivanbasic/subscriptions","organizations_url":"https://api.github.com/users/nm-ivanbasic/orgs","repos_url":"https://api.github.com/users/nm-ivanbasic/repos","events_url":"https://api.github.com/users/nm-ivanbasic/events{/privacy}","received_events_url":"https://api.github.com/users/nm-ivanbasic/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-13T09:37:03Z
2023-11-06T06:54:47Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3717/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3717/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3717/timeline
88
https://github.com/reduxjs/redux-toolkit/issues/3713
Feature, Discussion
RTK, RTKQCannot read properties of undefined (reading 'merge')merge codesplitting issue with store recreationthis comment answers it well but could be documented somewhere53713
I am trying to do code splitting

Parent code:
```js
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
// initialize an empty api service that we'll inject endpoints into later as needed
export const programPrepayEmptyApiSlice = createApi({
reducerPath: 'reducerPath',
baseQuery: fetchBaseQuery({
baseUrl: '/',
}),
tagTypes: ['Post'],
endpoints: () => ({}),
});
```
Other Module:
```js
import { emptyApiSlice } from 'container/StoreModule';

const extendedApi = programPrepayEmptyApiSlice.injectEndpoints({
endpoints: (build) => ({
example: build.query({
query: () => ({ url: 'https://cat-fact.herokuapp.com/facts/' }),
providesTags: ['Post'],
}),
}),
overrideExisting: false,
});

export const { useExampleQuery } = extendedApi;
```

But when I execute the code I am getting the below error
<img width="495" alt="redux-inject-error" src="https://github.com/reduxjs/redux-toolkit/assets/29046140/ecccd7f4-d934-41a1-932b-cb5170f6259c">

I am using redux-persist
```js
const persistConfig = {
key: 'root',
storage,
};
const persistedReducer = persistReducer(persistConfig, reducerSlices);

export const store = configureStore({
reducer: persistedReducer,
middleware,
});

export const persistor: Persistor = persistStore(store);
```
[]
{"login":"Aravinth-0812","id":29046140,"node_id":"MDQ6VXNlcjI5MDQ2MTQw","avatar_url":"https://avatars.githubusercontent.com/u/29046140?v=4","gravatar_id":"","url":"https://api.github.com/users/Aravinth-0812","html_url":"https://github.com/Aravinth-0812","followers_url":"https://api.github.com/users/Aravinth-0812/followers","following_url":"https://api.github.com/users/Aravinth-0812/following{/other_user}","gists_url":"https://api.github.com/users/Aravinth-0812/gists{/gist_id}","starred_url":"https://api.github.com/users/Aravinth-0812/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aravinth-0812/subscriptions","organizations_url":"https://api.github.com/users/Aravinth-0812/orgs","repos_url":"https://api.github.com/users/Aravinth-0812/repos","events_url":"https://api.github.com/users/Aravinth-0812/events{/privacy}","received_events_url":"https://api.github.com/users/Aravinth-0812/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-12T10:57:04Z
2023-09-13T12:20:18Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3713/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3713/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3713/timeline
89
https://github.com/reduxjs/redux-toolkit/issues/3711
BugRTKQpreferCacheValue not behaving as intended.preferCacheValue33711
I'm using a lazy query with preferCacheValue set to false, but it is still preferring a cached value no matter how many times I'm calling it.

![image](https://github.com/reduxjs/redux-toolkit/assets/56234473/7310b0d0-126a-4812-bacc-e24e5bcb0c11)


I've noticed that it's just not refetching new values at all in this case, and just defaulting to a cached one. I understand that without a changed body, it doesn't normally fetch again, but I have preferCacheValue set to false with a lazy query, shouldn't it refetch anyways? For context, I'm basically having it repull data that may have changed after the page has loaded.
[]
{"login":"JasonYCao","id":56234473,"node_id":"MDQ6VXNlcjU2MjM0NDcz","avatar_url":"https://avatars.githubusercontent.com/u/56234473?v=4","gravatar_id":"","url":"https://api.github.com/users/JasonYCao","html_url":"https://github.com/JasonYCao","followers_url":"https://api.github.com/users/JasonYCao/followers","following_url":"https://api.github.com/users/JasonYCao/following{/other_user}","gists_url":"https://api.github.com/users/JasonYCao/gists{/gist_id}","starred_url":"https://api.github.com/users/JasonYCao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JasonYCao/subscriptions","organizations_url":"https://api.github.com/users/JasonYCao/orgs","repos_url":"https://api.github.com/users/JasonYCao/repos","events_url":"https://api.github.com/users/JasonYCao/events{/privacy}","received_events_url":"https://api.github.com/users/JasonYCao/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-11T22:49:21Z
2024-01-13T01:43:38Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3711/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3711/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3711/timeline
90
https://github.com/reduxjs/redux-toolkit/issues/3710
Bug, FeatureRTKQCache invalidation not working on failed requestscache invalidation + docs23710
I have two APIs. One to log in with my credentials and one to access data.

The second API for the data requires the token from the first request. In some cases, the second API might be called without the user being logged in. In that case it does return a `401 Unauthorized` HTTP Status Code.

```
export const generalApi = createApi({
reducerPath: 'api',
tagTypes: [ 'data' ],
baseQuery: fetchBaseQuery({
baseUrl: 'https://api.mydomain.com/v1/',
prepareHeaders: (headers, { getState })=> {
const token = getState().session.token;

if (token) {
headers.set('authorization', `Bearer ${token}`);
}

return headers;
}
}),
endpoints: (builder)=> ({
getData: builder.query({
query: ({ id })=> 'getData/' + encodeURIComponent(JSON.stringify({ id: id })),
transformResponse: (response)=> response.dataContent,
transformErrorResponse: (response)=> response.error,
providesTags: [ 'data' ],
}),
login: builder.mutation({
query: (body)=> ({
url: 'login',
method: 'POST',
body: body
}),
invalidatesTags: [ 'data' ]
}),
}),
});
```

Where the token is stored in a separate slice
```
const sessionSlice = createSlice({
name: 'session',
initialState: { token: null },
reducers: {},
extraReducers: (builder)=> {
builder.addMatcher(
generalApi.endpoints.login.matchFulfilled,
(state, { payload })=> {
state.token = payload.token ?? null;
}
);
},
});
```

**Desired behavior:**
After successful login I expect the tag 'data' to be invalidated and the getData API to be called again. However, as it ran into a `401` before, nothing does happen and my component which implemented the `useGetDataQuery()` doesn't see any update. If I disable the 401 on server side, the caching invalidation works as expected, though I personally feel like this is a rather ugly implementation. Another workaround would be to implement a `skip` condition, though there might be cases where I cannot predict and avoid some `401` errors on client side.
[]
{"login":"nikischin","id":49103409,"node_id":"MDQ6VXNlcjQ5MTAzNDA5","avatar_url":"https://avatars.githubusercontent.com/u/49103409?v=4","gravatar_id":"","url":"https://api.github.com/users/nikischin","html_url":"https://github.com/nikischin","followers_url":"https://api.github.com/users/nikischin/followers","following_url":"https://api.github.com/users/nikischin/following{/other_user}","gists_url":"https://api.github.com/users/nikischin/gists{/gist_id}","starred_url":"https://api.github.com/users/nikischin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikischin/subscriptions","organizations_url":"https://api.github.com/users/nikischin/orgs","repos_url":"https://api.github.com/users/nikischin/repos","events_url":"https://api.github.com/users/nikischin/events{/privacy}","received_events_url":"https://api.github.com/users/nikischin/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-10T19:46:18Z
2023-10-03T15:17:33Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3710/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3710/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3710/timeline
91
https://github.com/reduxjs/redux-toolkit/issues/3707FeatureRTKQSupport for explicit resource management "using statements" on RTK Query subscriptionssubscriptions resource managementOpen PR and responded to by ben with a suggestion13707
## Background
RTK Query is built around the concept of consumers subscribing and unsubscribing from endpoints as required. The subscription count is used to determine when data is in use and caches can be cleared.

This is quite nice in React when using hooks as the hook lifetime is directly coupled to the subscription lifetime.

RTK Query supports being used in other frameworks and outside of React components where the subscription must be manually unsubscribed when finished with.

This makes it easy to introduce subtle bugs especially when dealing with exceptions so ideally every manual dispatch of an `initiate` action should be unsubscribed in a finally block which can get messy when dealing with multiple subscriptions.

## Explicit resource management
Explicit resource management is a stage 3 TC39 proposal to add `using` statements to Javascript to solve this exact problem. It was recently shipped as part of Typescript 5.2 and is available in Javascript using babel.

See:
- https://github.com/tc39/proposal-explicit-resource-management
- https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#using-declarations-and-explicit-resource-management
- https://babeljs.io/docs/babel-plugin-proposal-explicit-resource-management

I would like to propose adding a `[Symbol.dispose]` method to the object returned from `dispatch(endpoint.initiate()` so it can cleaned up with a using block.

## What does that look like for consumers?

In this snippet we're cleaning up the subscriptions manually. I'm trying to simulate a real world scenario where the second subscription isn't always created so we need multiple finally blocks.

```
const subscription1 = store.dispatch(pokemonApi.endpoints.getPokemonByName.initiate('bulbasaur'));
try {
const { data : pokemon1 } = await subscription1;
processPokemon(pokemon1);
if (shouldFetchPicachu()) {
const subscription2 = store.dispatch(pokemonApi.endpoints.getPokemonByName.initiate('pikachu'));
try {
const { data : pokemon2 } = await subscription2;
processPokemon(pokemon2);
} finally {
subscription2.unsubscribe();
}
}
}
finally {
subscription1.unsubscribe();
}
```

This is the same example again with using blocks demonstrating how much more ergonomic explicit resource management is.
```
using subscription1 = store.dispatch(pokemonApi.endpoints.getPokemonByName.initiate('bulbasaur'));
const { data : pokemon1 } = await subscription1;
processPokemon(pokemon1);

if (shouldFetchPicachu()) {
using subscription2 = store.dispatch(pokemonApi.endpoints.getPokemonByName.initiate('pikachu'));
const { data : pokemon2 } = await subscription2;
processPokemon(pokemon2);
}
```
[]
{"login":"jared-ca","id":139092017,"node_id":"U_kgDOCEpgMQ","avatar_url":"https://avatars.githubusercontent.com/u/139092017?v=4","gravatar_id":"","url":"https://api.github.com/users/jared-ca","html_url":"https://github.com/jared-ca","followers_url":"https://api.github.com/users/jared-ca/followers","following_url":"https://api.github.com/users/jared-ca/following{/other_user}","gists_url":"https://api.github.com/users/jared-ca/gists{/gist_id}","starred_url":"https://api.github.com/users/jared-ca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jared-ca/subscriptions","organizations_url":"https://api.github.com/users/jared-ca/orgs","repos_url":"https://api.github.com/users/jared-ca/repos","events_url":"https://api.github.com/users/jared-ca/events{/privacy}","received_events_url":"https://api.github.com/users/jared-ca/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-10T09:25:56Z
2023-09-10T15:29:12Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3707/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3707/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3707/timeline
92
https://github.com/reduxjs/redux-toolkit/issues/3701
FeatureRTKQHandle StreamingResponse and Server-Sent EventsStreamingMerged PR3
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3701
## Use Case
I want to display a Progress bar for process running in the backend. I am also writing the API so I can make it anything: a streaming response, SSE or even a websocket. I managed to make rtk-query work with all three of these solutions but only for GET requests. In my case, the process is triggered by a POST request and I seem unable to make it work.

## using onCacheEntryAdded
I would like to see rtk-query handling streaming responses and/or SSE. I made a simple version work with a StreamingResponse using the `onCacheEntryAdded` prop similar to how it's used in the docs for websockets. It feels quite quirky because, I have to set the original `queryFn: () => ({data: null})` and then write the whole fetching logic inside the `onCacheEntryAdded` function.

```ts
async onCacheEntryAdded(arg, { cacheDataLoaded }) {
console.log('here', arg);
await cacheDataLoaded;
// Would be nice if I had access to the baseQuery here
const response = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/risk_profiles/`
);
const reader = response.body
.pipeThrough(new TextDecoderStream())
.getReader();
let done, value;
while (!done) {
({ value, done } = await reader.read());
// Overwrite the data value
updateCachedData(() => value);
}
}
```

Without having looked at the code, I could imagine that maybe a returned ReadableStream response could be handled differently. Unfortunately, I can imagine two ways consecutive responses should be handled

a) By overwriting the previous value
b) By appending to a list

I'd say b) is the more general case and could be the default.

In any case, above works for a get request. Unfortunately, the `isLoading` is already `false` after it ran the `queryFn` and I haven't found a way to change it back to `true`.

The bigger issue is that this doesn't work for mutations like POST requests. While the mutation builder has `onCacheEntryAdded` property, it has no access to `updateCachedData`. Is there any specific reason for this? I think adding that to the props would be enough for me to hack a solution together for my use case. Even now I might be able to use the dispatch function, but I would love to see an easier way to do this in rtk-query.
[]
{"login":"saschahofmann","id":24508496,"node_id":"MDQ6VXNlcjI0NTA4NDk2","avatar_url":"https://avatars.githubusercontent.com/u/24508496?v=4","gravatar_id":"","url":"https://api.github.com/users/saschahofmann","html_url":"https://github.com/saschahofmann","followers_url":"https://api.github.com/users/saschahofmann/followers","following_url":"https://api.github.com/users/saschahofmann/following{/other_user}","gists_url":"https://api.github.com/users/saschahofmann/gists{/gist_id}","starred_url":"https://api.github.com/users/saschahofmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saschahofmann/subscriptions","organizations_url":"https://api.github.com/users/saschahofmann/orgs","repos_url":"https://api.github.com/users/saschahofmann/repos","events_url":"https://api.github.com/users/saschahofmann/events{/privacy}","received_events_url":"https://api.github.com/users/saschahofmann/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-09-06T14:43:00Z
2023-10-04T19:46:32Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3701/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3701/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3701/timeline
95
https://github.com/reduxjs/redux-toolkit/issues/3680
FeatureTS, RTKQAdd support for generated RTK queries hooks tsdoc documentationTSdoc support for exported hooks03680
Hi, I'm currently working with a very heavy API with long and complex endpoint names, which sometimes makes for some scarily obscure hook calls.

I was wondering if there was any way to **generate some sort of tsdoc-style documentation for the generated hooks**, so compatible editors can display a detailed description of the hook on hover (the description could be put together from the summary and description fields in the OpenAPI schema, if available) , or if there was any way to **customise the generation process** so these can be added on a per-repository basis, since this may be a very specific feature that not many people actually need.

Thanks a lot in advance for your help, and keep up the amazing work!
[]
{"login":"BSoDium","id":46868627,"node_id":"MDQ6VXNlcjQ2ODY4NjI3","avatar_url":"https://avatars.githubusercontent.com/u/46868627?v=4","gravatar_id":"","url":"https://api.github.com/users/BSoDium","html_url":"https://github.com/BSoDium","followers_url":"https://api.github.com/users/BSoDium/followers","following_url":"https://api.github.com/users/BSoDium/following{/other_user}","gists_url":"https://api.github.com/users/BSoDium/gists{/gist_id}","starred_url":"https://api.github.com/users/BSoDium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BSoDium/subscriptions","organizations_url":"https://api.github.com/users/BSoDium/orgs","repos_url":"https://api.github.com/users/BSoDium/repos","events_url":"https://api.github.com/users/BSoDium/events{/privacy}","received_events_url":"https://api.github.com/users/BSoDium/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-28T12:24:54Z
2023-08-28T12:24:54Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3680/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3680/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3680/timeline
96
https://github.com/reduxjs/redux-toolkit/issues/3676
QuestionRTKQHow to invalidate specific cache data only with a nested queryArgcache invalidation13676
Hello, I am trying to find out how i can invalidate a specific cache data with a nested object as a queryArg.

Most of the examples in RTK Query Document is using a string/number as an Id value to access the cache data and use it as part of invalidateTags/provideTags as an example. `invalidatesTags: (result, error, id) => [{ type: "Post", id }]`

I would like to refetch the page data based on only specific object. How can i invalidate a tag such that it only invalidates a specific cache data with a TableFilter object `{ Filter:'randomstring', PageNo: 5, PageSize:50 }` (after updating an object in my table on page 5) instead of invalidating every single cachekey (the pages i navigated through in my table) e.g. `{ Filter:'randomstring', PageNo: 1, PageSize:50 }, { Filter:'randomstring', PageNo: 2, PageSize:50 }, { Filter:'randomstring', PageNo: 5, PageSize:50 }`

Would appreciate your help on this. Thank you in advance.

```
interface TableFilter {
Filter: string;
PageNo: number;
PageSize: number;
}

export const SettingsApis = api
.enhanceEndpoints({
addTagTypes: ['UpdateSettings'],
})
.injectEndpoints({
endpoints: (build) => ({
getSettings: build.query<SettingsResponse, TableFilter>({
query: (queryArg) => {
return {
url: Endpoint.GET_SETTINGS,
body: queryArg,
method: 'POST',
};
},
providesTags: ['UpdateSettings'],
}),
updateSettings: build.mutation<UpdateResponse, SettingsModel>({
query: (queryArg) => {
return {
url: queryArg.Id == 0 ? Endpoint.INSERT_SETTINGS : Endpoint.UPDATE_SETTINGS,
body: queryArg,
method: 'POST',
};
},
invalidatesTags: ['UpdateSettings'],
}),
}),
overrideExisting: false,
});
```
[]
{"login":"DarrenCzen","id":29244334,"node_id":"MDQ6VXNlcjI5MjQ0MzM0","avatar_url":"https://avatars.githubusercontent.com/u/29244334?v=4","gravatar_id":"","url":"https://api.github.com/users/DarrenCzen","html_url":"https://github.com/DarrenCzen","followers_url":"https://api.github.com/users/DarrenCzen/followers","following_url":"https://api.github.com/users/DarrenCzen/following{/other_user}","gists_url":"https://api.github.com/users/DarrenCzen/gists{/gist_id}","starred_url":"https://api.github.com/users/DarrenCzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DarrenCzen/subscriptions","organizations_url":"https://api.github.com/users/DarrenCzen/orgs","repos_url":"https://api.github.com/users/DarrenCzen/repos","events_url":"https://api.github.com/users/DarrenCzen/events{/privacy}","received_events_url":"https://api.github.com/users/DarrenCzen/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-26T01:53:15Z
2024-01-18T08:54:12Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3676/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3676/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3676/timeline
97
https://github.com/reduxjs/redux-toolkit/issues/3674
Feature, QuestionRTKQRe-use Api Endpoints & Extend RTK Query Base Queriescode splitting, baseQuery overridefeels related to #359803674
### Scenario

I have a monorepo setup made with nx which contains 2 web apps and a set of libs. Libs are splitted as **shared-lib** and **admin-lib**. Each lib has it's own redux setup (store, slices and rtkq apis). Given that for my admin app I've created a dedicated admin-lib, there is an rtkq api which I want to extend from the shared-lib.

All good so far, i can use `mySharedApi.injectEndpoints({...})` and it works.


### Problem

Both APIs have their own custom implementation of baseQuery, on admin one I also have a handler for when an api endpoint gives 403 and dispatches an action inside it's custom baseQuery implementation to notify the app the user isn't allowed to access certain resources. But since I need some endpoints only from the sharedApi, that api isn't linked to second baseQuery, therefore the admin one isn't called.


### Summary

How can i merge 2 API endpoints and override the baseQuery from the one that's extended.


### Some code for reference:

```
export const adminApi = sharedApi.injectEndpoints({
_reducerPath: 'adminApi',_
_baseQuery: baseAdminQueryWithReauth({ baseUrl: 'resource', retries: 3 }),_ << custom baseQuery with 403 handler
_tagTypes: ['Resources'],_
endpoints: builder => ({
getAdminResources: builder
.query<any, Partial<any>>({
query: query => '/v2/search?${ stringify(query) }',
providesTags: ['Resources'],
}),
});
```

```
export const sharedApi = createApi({
reducerPath: 'sharedApi',
baseQuery: baseQueryWithReauth({ baseUrl: 'resource', retries: 3 }), << custom baseQuery **without** 403 handler
tagTypes: ['Resources'],
endpoints: builder => ({
someNonAdminEndpoint: builder
.query<any, Partial<any>>({
query: query => '/v2/search?${ stringify(query) }',
providesTags: ['Resources'],
}),
});
```

```
export const createBaseQuery = ({ baseUrl = '', retries = 0 }) => {
const baseQuery = fetchBaseQuery({
baseUrl: `/api/${ baseUrl }`,
prepareHeaders: (headers) => {
// By default, if we have a token in the store, let's use that for authenticated requests
const token = getFromLocalStorage(LOCAL_STORAGE_DATA_KEY.idToken);

if (token) {
headers.set('Authorization', token);
}
return headers;
},
});

if (retries) {
return retry(baseQuery, { maxRetries: retries - 1 });
}


return baseQuery;
};

export const baseAdminQueryWithReauth = (props: BaseQueryPropTypes) => {
const fn: BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError> = async (
args,
api,
extraOptions
): Promise<any> => {
const result = await createBaseQuery(props)(args, api, extraOptions);

if (result.error?.status === Status.FORBIDDEN) {
store.dispatch(setForbidden(true));
return result;
}

// additional checks for auth_token and refresh_token logic

return result;
};

return fn;
};
```

### Packages versions
- "@reduxjs/toolkit": "^1.7.2",
- "react-redux": "^7.2.6",
[]
{"login":"miordache93","id":10475027,"node_id":"MDQ6VXNlcjEwNDc1MDI3","avatar_url":"https://avatars.githubusercontent.com/u/10475027?v=4","gravatar_id":"","url":"https://api.github.com/users/miordache93","html_url":"https://github.com/miordache93","followers_url":"https://api.github.com/users/miordache93/followers","following_url":"https://api.github.com/users/miordache93/following{/other_user}","gists_url":"https://api.github.com/users/miordache93/gists{/gist_id}","starred_url":"https://api.github.com/users/miordache93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miordache93/subscriptions","organizations_url":"https://api.github.com/users/miordache93/orgs","repos_url":"https://api.github.com/users/miordache93/repos","events_url":"https://api.github.com/users/miordache93/events{/privacy}","received_events_url":"https://api.github.com/users/miordache93/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-24T18:43:42Z
2023-08-24T20:51:18Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3674/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3674/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3674/timeline
98
https://github.com/reduxjs/redux-toolkit/issues/3661
QuestionRTKQ, RNimplementing expiration logic into extractRehydrationInfo doesn't work persist, hydrate, RN03661
Hey all!

I am using RTKQuery in React-Native app and I am trying to persist querie's cached data.
Following docs, the persistence from redux-persist + RTKQuery does work.

However, currently I am trying to implement an expiration logic to the persisted data and check if the last query was triggered more than a certain time ago (let's say 7 days as on the example snippet below), then the data shouldn't be rehydrated and the new query will be triggered once a component is mounted.

I've seen that RTK docs advice on using "extractRehydrationInfo" option to implement a rehydration logic and my 'rough' implementation looks like this:

```
extractRehydrationInfo(action, { reducerPath }) {
if (action.type === REHYDRATE) {
const currentTime = Date.now();
const queryObj = new Object(action.payload.queries);
const lastQueryTime = Object.entries(queryObj)[0][1].fulfilledTimeStamp;
const sevenDays = 604800000;
const isWithinExpiry = lastQueryTime > currentTime - sevenDays;
if (isWithinExpiry) {
return action.payload[reducerPath];
}
return undefined;
}
},
```

However, what is notice is that the rehydration is taken place at all times and the logic of when to 'return action.payload[reducerPath]' is completely ignored.

So basically the code below also rehydrates the persisted state:
```
extractRehydrationInfo(action, { reducerPath }) {
if (action.type === REHYDRATE) {
return undefined;
}
},
```

I am a bit confused here, as I assumed that it shouldn't be the case and when we return 'undefined' the rehdyrated data should be set to undefined i.e. not rehydrated.

Am I getting something completely wrong or there is an issue with this option?

Any help or advice is much appreciated !
[]
{"login":"dvijeniii05","id":67027576,"node_id":"MDQ6VXNlcjY3MDI3NTc2","avatar_url":"https://avatars.githubusercontent.com/u/67027576?v=4","gravatar_id":"","url":"https://api.github.com/users/dvijeniii05","html_url":"https://github.com/dvijeniii05","followers_url":"https://api.github.com/users/dvijeniii05/followers","following_url":"https://api.github.com/users/dvijeniii05/following{/other_user}","gists_url":"https://api.github.com/users/dvijeniii05/gists{/gist_id}","starred_url":"https://api.github.com/users/dvijeniii05/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvijeniii05/subscriptions","organizations_url":"https://api.github.com/users/dvijeniii05/orgs","repos_url":"https://api.github.com/users/dvijeniii05/repos","events_url":"https://api.github.com/users/dvijeniii05/events{/privacy}","received_events_url":"https://api.github.com/users/dvijeniii05/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-18T10:35:34Z
2023-08-18T10:35:34Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3661/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3661/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3661/timeline
99
https://github.com/reduxjs/redux-toolkit/issues/3652
Bug, QuestionRTKQ, RNRTK Query: refetchOnFocus is not working for me in a ReactNative applisteners RNthis comment of a working solution in the thread83652
Hi, reading the docs at https://redux-toolkit.js.org/rtk-query/usage/cache-behavior#re-fetching-on-window-focus-with-refetchonfocus
I expect my queries to be refetched when the app is gaining focus again when running in the background for a while...but nothing happens.

```
export const apiSlice = createApi({
baseQuery: baseQueryWithReauth,
endpoints: () => ({
...
}),
refetchOnFocus: true,
});
```
What do I miss?
[]
{"login":"jr00n","id":495355,"node_id":"MDQ6VXNlcjQ5NTM1NQ==","avatar_url":"https://avatars.githubusercontent.com/u/495355?v=4","gravatar_id":"","url":"https://api.github.com/users/jr00n","html_url":"https://github.com/jr00n","followers_url":"https://api.github.com/users/jr00n/followers","following_url":"https://api.github.com/users/jr00n/following{/other_user}","gists_url":"https://api.github.com/users/jr00n/gists{/gist_id}","starred_url":"https://api.github.com/users/jr00n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jr00n/subscriptions","organizations_url":"https://api.github.com/users/jr00n/orgs","repos_url":"https://api.github.com/users/jr00n/repos","events_url":"https://api.github.com/users/jr00n/events{/privacy}","received_events_url":"https://api.github.com/users/jr00n/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-11T10:17:43Z
2024-01-18T13:37:21Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3652/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3652/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3652/timeline
100
https://github.com/reduxjs/redux-toolkit/issues/3650
BugTS, RTKQ, DocsRTK Query: selectFromResult must return an object (docs could be more clear on this)selectFromResult useQueryState18
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/13","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13/labels","id":10275572,"node_id":"MI_kwDOB2ACAs4AnMr0","number":13,"title":"2.x bugfixes","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":6,"state":"open","created_at":"2023-12-06T12:49:04Z","updated_at":"2024-01-21T01:26:46Z","due_on":null,"closed_at":null}
3650
_Edited based on discussion below_

The docs could be more clear about the expected/required return value from `selectFromResult` (and maybe reasons for those expectations)

Original issue:

As the title states, if the selectFromResult function returns a value directly, it results in the following error:

```rtk-query-react.esm.js:318 Uncaught TypeError: Cannot read properties of undefined (reading 'data')```

The issue appears to stem from `useQuery` relying on `useQueryState` which returns `undefined` after a few renders, causing the above error on this line: https://github.com/reduxjs/redux-toolkit/blob/e45425128d3c3168c7daa71e5f38f5151234cb8d/packages/toolkit/src/query/react/buildHooks.ts#L963-L972

This behavior may be intentional - if so, the docs should be updated to reflect that.
[]
{"login":"gillycheesesteak","id":5541424,"node_id":"MDQ6VXNlcjU1NDE0MjQ=","avatar_url":"https://avatars.githubusercontent.com/u/5541424?v=4","gravatar_id":"","url":"https://api.github.com/users/gillycheesesteak","html_url":"https://github.com/gillycheesesteak","followers_url":"https://api.github.com/users/gillycheesesteak/followers","following_url":"https://api.github.com/users/gillycheesesteak/following{/other_user}","gists_url":"https://api.github.com/users/gillycheesesteak/gists{/gist_id}","starred_url":"https://api.github.com/users/gillycheesesteak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gillycheesesteak/subscriptions","organizations_url":"https://api.github.com/users/gillycheesesteak/orgs","repos_url":"https://api.github.com/users/gillycheesesteak/repos","events_url":"https://api.github.com/users/gillycheesesteak/events{/privacy}","received_events_url":"https://api.github.com/users/gillycheesesteak/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-09T02:19:19Z
2023-12-17T20:49:05Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3650/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3650/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3650/timeline
101
https://github.com/reduxjs/redux-toolkit/issues/3649
FeatureRTKQInvalidate cache based on header valuecache invalidation, serializeQueryArgs43649
Hi,

I have an API which receives a header containing an ID value. When this header value changes, I want RTK Query to see the API call as being different even if the URL & parameters are the same, rather than using the cache.

I've attempted to handle this using tags but
1) I don't want to have to add the same `providesTags` value to every single endpoint in my application; and
2) The ID for the header is not changed using a mutation, instead it's in the state, so there's nowhere to put an `invalidatesTags` property.

---

Essentially, I just want to configure the caching so it sees:
> GET /api/myresource/1
> MyHeader: 1

as a different request to:
> GET /api/myresource/1
> MyHeader: 2

Right now, it uses the cache even when the header value is different, which causes errors as the header value affects what data comes back from the API.

Any help much appreciated as I can't find anything in the docs about modifying the cache behaviour the way I want to.
[]
{"login":"benosmond","id":63732054,"node_id":"MDQ6VXNlcjYzNzMyMDU0","avatar_url":"https://avatars.githubusercontent.com/u/63732054?v=4","gravatar_id":"","url":"https://api.github.com/users/benosmond","html_url":"https://github.com/benosmond","followers_url":"https://api.github.com/users/benosmond/followers","following_url":"https://api.github.com/users/benosmond/following{/other_user}","gists_url":"https://api.github.com/users/benosmond/gists{/gist_id}","starred_url":"https://api.github.com/users/benosmond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benosmond/subscriptions","organizations_url":"https://api.github.com/users/benosmond/orgs","repos_url":"https://api.github.com/users/benosmond/repos","events_url":"https://api.github.com/users/benosmond/events{/privacy}","received_events_url":"https://api.github.com/users/benosmond/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-08T19:25:49Z
2023-08-09T10:56:59Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3649/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3649/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3649/timeline
102
https://github.com/reduxjs/redux-toolkit/issues/3648
BugRTKQ-Code-GenCodegen OpenAPI translates anyOf number/integer to any typeoazapfts23648
In my OpenAPI schema I have a schema type defined as
```json
{
"Coordinates": {
"prefixItems": [
{
"anyOf": [
{
"type": "number"
},
{
"type": "integer"
}
],
"title": "Lon"
},
{
"anyOf": [
{
"type": "number"
},
{
"type": "integer"
}
],
"title": "Lat"
}
],
"type": "array",
"maxItems": 2,
"minItems": 2
}
}

```
which I would expect to be read as
```ts
type Coordinates = [number, number]
```
but instead I receive
```ts
type Coordinates = any;
```

## More details
I am running an API using FastAPI, I generate the OpenAPI schema using the inbuilt method which produces a schema with `"openapi": "3.1.0"`. I then use `rtk-query-codegen-openapi` to create my frontend client.


## Reproducible example
Given this `openapi.json`
```json
{
"openapi": "3.1.0",
"info": {
"title": "Test",
"description": "",
"version": "1.0.0"
},
"paths": {
"/test/": {
"get": {
"summary": "",
"description": "",
"operationId": "get_test",
"parameters": [],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Coordinates"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Coordinates": {
"prefixItems": [
{
"anyOf": [
{
"type": "number"
},
{
"type": "integer"
}
],
"title": "Lon"
},
{
"anyOf": [
{
"type": "number"
},
{
"type": "integer"
}
],
"title": "Lat"
}
],
"type": "array",
"maxItems": 2,
"minItems": 2
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": ["loc", "msg", "type"],
"title": "ValidationError"
}
}
}
}
```
this `empyApi.ts`

```ts
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";

// initialize an empty api service that we'll inject endpoints into later as needed
export const emptyApi = createApi({
reducerPath: "api",
baseQuery: fetchBaseQuery({
baseUrl: "localhost",
}),
endpoints: () => ({}),
});
```
and the is `openApiConfig.json`

```json
{
"schemaFile": "openapi.json",
"apiFile": "./emptyApi.ts",
"apiImport": "emptyApi",
"outputFile": "./apiClient.ts",
"exportName": "apiClient",
"hooks": true,
"tag": true
}
```

I receive this `apiClient.ts` after running `rtk-query-codegen-openapi openApiConfig.json`
```ts
import { emptyApi as api } from "./emptyApi";
export const addTagTypes = [] as const;
const injectedRtkApi = api
.enhanceEndpoints({
addTagTypes,
})
.injectEndpoints({
endpoints: (build) => ({
getTest: build.query<GetTestApiResponse, GetTestApiArg>({
query: () => ({ url: `/test/` }),
}),
}),
overrideExisting: false,
});
export { injectedRtkApi as apiClient };
export type GetTestApiResponse =
/** status 200 Successful Response */ Coordinates;
export type GetTestApiArg = void;
export type Coordinates = any;
export type ValidationError = {
loc: (string | number)[];
msg: string;
type: string;
};
export type HttpValidationError = {
detail?: ValidationError[];
};
export const { useGetTestQuery } = injectedRtkApi;
```

As you can see in L19 `Coordinates` is typed as `any`.

[]
{"login":"saschahofmann","id":24508496,"node_id":"MDQ6VXNlcjI0NTA4NDk2","avatar_url":"https://avatars.githubusercontent.com/u/24508496?v=4","gravatar_id":"","url":"https://api.github.com/users/saschahofmann","html_url":"https://github.com/saschahofmann","followers_url":"https://api.github.com/users/saschahofmann/followers","following_url":"https://api.github.com/users/saschahofmann/following{/other_user}","gists_url":"https://api.github.com/users/saschahofmann/gists{/gist_id}","starred_url":"https://api.github.com/users/saschahofmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saschahofmann/subscriptions","organizations_url":"https://api.github.com/users/saschahofmann/orgs","repos_url":"https://api.github.com/users/saschahofmann/repos","events_url":"https://api.github.com/users/saschahofmann/events{/privacy}","received_events_url":"https://api.github.com/users/saschahofmann/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-08T14:18:35Z
2023-08-28T14:23:13Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3648/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3648/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3648/timeline
reopened
103
https://github.com/reduxjs/redux-toolkit/issues/3646
FeatureRTKQ[Feature Request] [RTK Query] Prefix Inject Endpoints with URL (either versioning or shared base)injectEndpoints - prefixUrl option03646
## Feature Request

Looking for a feature that will prefix the injectEndpoint urls with added context similar to how baseUrl prefixes every URL. The example would look like this

### Example
![image](https://github.com/reduxjs/redux-toolkit/assets/55673046/baaf2c94-79e5-4101-987a-093ae102da0e)

This could have multiple purpose but we have a microservice architecture so the code split folders commonly have shared prefixes such as `user` or `notification` but most importantly versioning like `v1` so we can update an entire microservice versioning without copy pasting each individual hook.
[]
{"login":"MylesWardell","id":55673046,"node_id":"MDQ6VXNlcjU1NjczMDQ2","avatar_url":"https://avatars.githubusercontent.com/u/55673046?v=4","gravatar_id":"","url":"https://api.github.com/users/MylesWardell","html_url":"https://github.com/MylesWardell","followers_url":"https://api.github.com/users/MylesWardell/followers","following_url":"https://api.github.com/users/MylesWardell/following{/other_user}","gists_url":"https://api.github.com/users/MylesWardell/gists{/gist_id}","starred_url":"https://api.github.com/users/MylesWardell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MylesWardell/subscriptions","organizations_url":"https://api.github.com/users/MylesWardell/orgs","repos_url":"https://api.github.com/users/MylesWardell/repos","events_url":"https://api.github.com/users/MylesWardell/events{/privacy}","received_events_url":"https://api.github.com/users/MylesWardell/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-08T04:52:30Z
2023-08-08T04:53:05Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3646/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3646/reactions","total_count":6,"+1":6,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3646/timeline
105
https://github.com/reduxjs/redux-toolkit/issues/3644
Bug, QuestionRTKQRTK-query: Behavior of the keepUnusedDataForkeepUnusedDataFor03644
### Discussed in https://github.com/reduxjs/redux-toolkit/discussions/3638

<div type='discussions-op-text'>

<sup>Originally posted by **01-binary** August 4, 2023</sup>
When you have pages a and b, you use the same useSomeQuery on pages a and b.
not to use cache I gave option `keepUnusedDataFor: 0` on useSomeQuery.

Both pages a and b use the condition `isLoading`.
if isLoading is true, the loading component is shown.

```
const {
isUninitialized,
isFetching,
currentData
} = useSomeQuery(
{
....,
},
{
refetchOnMountOrArgChange: true,
},
);

const isLoading = isUninitialized || isFetching;
```

but when moving from page a to page b, page b flickers.
So I ran console.log on page b.

`console.log(isUninitialized, isFetching);`

Three console.logs are run, the results are
`true false` , `false false` , `false true` in that order.
The reason why the flicker phenomenon occurs is the second result.

Since the cache is not used, an API request is made again, but isUninitialized and isFetching become false just before that.

UnsubscribeQueryResult is executed between the first result and the second result, and at that stage, isUninitialized does not change to true and remains false.

It seems to distinguish whether or not to access a specific cache as an argument of the hook(ex: useSomeQuery), so I put in an argument such as an unused id and it worked as I expected.

As another example, there is no problem when moving between page a using useSomeQuery and page b not using it.

I wonder if I am using rtk-query incorrectly or if it is a bug in rtk-query.
If it's a bug, I'll contribute.

Thanks for reading.</div>
[]
{"login":"01-binary","id":15652602,"node_id":"MDQ6VXNlcjE1NjUyNjAy","avatar_url":"https://avatars.githubusercontent.com/u/15652602?v=4","gravatar_id":"","url":"https://api.github.com/users/01-binary","html_url":"https://github.com/01-binary","followers_url":"https://api.github.com/users/01-binary/followers","following_url":"https://api.github.com/users/01-binary/following{/other_user}","gists_url":"https://api.github.com/users/01-binary/gists{/gist_id}","starred_url":"https://api.github.com/users/01-binary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/01-binary/subscriptions","organizations_url":"https://api.github.com/users/01-binary/orgs","repos_url":"https://api.github.com/users/01-binary/repos","events_url":"https://api.github.com/users/01-binary/events{/privacy}","received_events_url":"https://api.github.com/users/01-binary/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-07T10:45:09Z
2023-12-20T20:55:02Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3644/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3644/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3644/timeline
106
https://github.com/reduxjs/redux-toolkit/issues/3640
BugRTKQHow to Serialize Query Args??? Bug?serializeQueryArgslonger discussion12
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/13","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13/labels","id":10275572,"node_id":"MI_kwDOB2ACAs4AnMr0","number":13,"title":"2.x bugfixes","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":6,"state":"open","created_at":"2023-12-06T12:49:04Z","updated_at":"2024-01-21T01:26:46Z","due_on":null,"closed_at":null}
3640
I would like to be able to supply things like Date objects as parameters to my endpoints (vs requiring the user to serialize things beforehand, which is tedious and susceptible to error).

So, for instance, I may have an endpoint like so:
```
export interface GetScheduleVariables {
schedule: ScheduleIdentifier;
}

export const MyApi = createApi({
reducerPath: 'myApi',
baseQuery: fetchBaseQuery({ baseUrl }),
endpoints: (builder) => ({
getSchedule: builder.query<GetSchedule, GetScheduleVariables>({
// attempt to make RTK Query happy about the date...
serializeQueryArgs: (params) => {
return JSON.stringify({
schedule: {
code: params.queryArgs.schedule.code,
date: params.queryArgs.schedule.date.toISOString()
}
});
},
query: (params) => ({
...
})
}),
})
});
```

The request itself executes fine - but the console is filled with errors like this:
```
A non-serializable value was detected in the state, in the path: myApi.queries.{"schedule":{"code":"5ea5d2ec-59f6-4ed1-a9d2-fed92e532c73","date":"2023-07-27T00:00:00.000Z"},"filter":{}}.originalArgs.schedule.date. Value: Date Wed Jul 26 2023 17:00:00 GMT-0700 (Pacific Daylight Time)

Take a look at the reducer(s) handling this action type: myApi/executeQuery/pending.

(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)
```

So, despite the SerializeQueryArgs configuration, the Date object is hitting the store... Have I implemented my SerializeQueryArgs function incorrectly? Or is there something else I can try to serialize the arguments as part of my endpoint configuration?
[]
{"login":"rwilliams3088","id":106355404,"node_id":"U_kgDOBlbazA","avatar_url":"https://avatars.githubusercontent.com/u/106355404?v=4","gravatar_id":"","url":"https://api.github.com/users/rwilliams3088","html_url":"https://github.com/rwilliams3088","followers_url":"https://api.github.com/users/rwilliams3088/followers","following_url":"https://api.github.com/users/rwilliams3088/following{/other_user}","gists_url":"https://api.github.com/users/rwilliams3088/gists{/gist_id}","starred_url":"https://api.github.com/users/rwilliams3088/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwilliams3088/subscriptions","organizations_url":"https://api.github.com/users/rwilliams3088/orgs","repos_url":"https://api.github.com/users/rwilliams3088/repos","events_url":"https://api.github.com/users/rwilliams3088/events{/privacy}","received_events_url":"https://api.github.com/users/rwilliams3088/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-08-04T11:33:54Z
2023-12-06T12:49:44Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3640/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3640/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3640/timeline
107
https://github.com/reduxjs/redux-toolkit/issues/3604
BugRTKQ-Code-GenOpenAPI codegen + Prettier 3 pluginsprettier v323604
Adding Tailwind plugin to Prettier breaks codegen

```
{
"name": "openapi-test",
"dependencies": {
"@rtk-query/codegen-openapi": "^1.0.0",
"prettier": "^3.0.0",
"prettier-plugin-tailwindcss": "^0.4.1"
}
}
```

```
// openapi.config.js
module.exports = {
schemaFile: 'https://raw.githubusercontent.com/reduxjs/redux-toolkit/master/packages/rtk-query-codegen-openapi/test/fixtures/petstore.json',
apiFile: 'https://raw.githubusercontent.com/reduxjs/redux-toolkit/master/packages/rtk-query-codegen-openapi/test/fixtures/emptyApi.ts',
outputFile: './example.ts',
};
```

```
// prettier.config.js
module.exports = {
printWidth: 10000,
plugins: ['prettier-plugin-tailwindcss'], // remove this to make codegen work
}
```

Output
```
npx @rtk-query/codegen-openapi openapi.config.js
Generating ./example.ts
TypeError: Cannot read properties of undefined (reading 'startsWith')
at printAngular (___\openapi-test\node_modules\@rtk-query\codegen-openapi\node_modules\prettier\index.js:24775:22)
...
```

[]
{"login":"philsp","id":4530649,"node_id":"MDQ6VXNlcjQ1MzA2NDk=","avatar_url":"https://avatars.githubusercontent.com/u/4530649?v=4","gravatar_id":"","url":"https://api.github.com/users/philsp","html_url":"https://github.com/philsp","followers_url":"https://api.github.com/users/philsp/followers","following_url":"https://api.github.com/users/philsp/following{/other_user}","gists_url":"https://api.github.com/users/philsp/gists{/gist_id}","starred_url":"https://api.github.com/users/philsp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philsp/subscriptions","organizations_url":"https://api.github.com/users/philsp/orgs","repos_url":"https://api.github.com/users/philsp/repos","events_url":"https://api.github.com/users/philsp/events{/privacy}","received_events_url":"https://api.github.com/users/philsp/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-07-19T07:23:53Z
2023-07-29T14:33:30Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3604/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3604/reactions","total_count":2,"+1":2,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3604/timeline
108
https://github.com/reduxjs/redux-toolkit/issues/3603
BugRTKQ-Code-GenEndpoint that produce text/plain is not mapped to "string" type when generating with rtk codegen openapitext/plain not mapped to string03603
The following openapi yaml

```yaml
openapi: 3.0.0
info:
title: HelloWorldApp
version: '1.0'
paths:
/hello-world:
get:
operationId: helloworld
responses:
'200':
description: 'Return "Hello world!'
content:
text/plain:
schema:
type: string
tags:
- HelloWorld

```

will produce the follwing code

```typescript
import { emptySplitApi as api } from './emptyApi';
export const addTagTypes = ['HelloWorld'] as const;
const injectedRtkApi = api
.enhanceEndpoints({
addTagTypes,
})
.injectEndpoints({
endpoints: (build) => ({
helloworld: build.query<HelloworldApiResponse, HelloworldApiArg>({
query: () => ({ url: `/hello-world` }),
providesTags: ['HelloWorld'],
}),
}),
overrideExisting: false,
});
export { injectedRtkApi as helloWorldApi };
export type HelloworldApiResponse = unknown;
export type HelloworldApiArg = void;
export const { useHelloworldQuery, useLazyHelloworldQuery } = injectedRtkApi;
```

As we can see, `type HelloworldApiResponse = unknown;` but it should be typed as a string
[]
{"login":"juliengbt","id":48599640,"node_id":"MDQ6VXNlcjQ4NTk5NjQw","avatar_url":"https://avatars.githubusercontent.com/u/48599640?v=4","gravatar_id":"","url":"https://api.github.com/users/juliengbt","html_url":"https://github.com/juliengbt","followers_url":"https://api.github.com/users/juliengbt/followers","following_url":"https://api.github.com/users/juliengbt/following{/other_user}","gists_url":"https://api.github.com/users/juliengbt/gists{/gist_id}","starred_url":"https://api.github.com/users/juliengbt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliengbt/subscriptions","organizations_url":"https://api.github.com/users/juliengbt/orgs","repos_url":"https://api.github.com/users/juliengbt/repos","events_url":"https://api.github.com/users/juliengbt/events{/privacy}","received_events_url":"https://api.github.com/users/juliengbt/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-07-19T01:03:57Z
2023-07-19T01:03:57Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3603/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3603/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3603/timeline
109
https://github.com/reduxjs/redux-toolkit/issues/3598
FeatureRTKQ[RED-15] Sharing a set of endpoints between the two `Api`s?sharing endpoints across APIfeels related to #36740
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3598
Hello,
I would like to define a set of endpoints I can use between two `Api` types. That way, if I need to alter or change those endpoints, I only need to modify it once for both `Api`s

For instance, I am looking to make some modules like so:
```sh
- src/
- - todo/
- - - todoEndpoints.ts # Set of endpoints for both `todoApi.ts` and `todoApiReact.ts`
- - - todoApi.ts # @reduxjs/toolkit/query
- - - todoApiReact.ts # @reduxjs/toolkit/query/react
```

I'd import and use the endpoints in a way like so:

```typescript
// todoApiReact.ts
import { createApi } from '@reduxjs/toolkit/query/react';
import { todoEndpoints } from './todoEndpoints.ts';

export const todoApiReact = createApi({
// ...
endpoints: todoEndpoints,
});
```

I'm imagining the endpoints module could look something like this:

```typescript
import type {
EndpointBuilder,
BaseQueryFn,
} from '@reduxjs/toolkit/query';

export const todoEndpoints = <T extends EndpointBuilder<BaseQueryFn, string, string>>(
builder: T,
) => ({
createTodo: builder.mutation</** ... */>(/** ... */),
readTodo: builder.query</** ... */>(/** ... */),
});
```

For my case, it would be especially useful if I could apply React hooks to my non-react api. Maybe like `const myReactApi = reactifyApi(myApi);`. Maybe that is already possible?

I understand I can create individual definitions with `EndpointDefinition(s)`, but it doesn't save time if I want to add new endpoints. Might be something I'm missing. How would one best share the same endpoints?

<sub>[RED-15](https://linear.app/redux/issue/RED-15/sharing-a-set-of-endpoints-between-the-two-apis)</sub>
[{"id":5992985876,"node_id":"LA_kwDOB2ACAs8AAAABZTW1FA","url":"https://api.github.com/repos/reduxjs/redux-toolkit/labels/linear","name":"linear","color":"4941DA","default":false,"description":"Created by Linear-GitHub Sync"}]
{"login":"eric-crowell","id":41806292,"node_id":"MDQ6VXNlcjQxODA2Mjky","avatar_url":"https://avatars.githubusercontent.com/u/41806292?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-crowell","html_url":"https://github.com/eric-crowell","followers_url":"https://api.github.com/users/eric-crowell/followers","following_url":"https://api.github.com/users/eric-crowell/following{/other_user}","gists_url":"https://api.github.com/users/eric-crowell/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-crowell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-crowell/subscriptions","organizations_url":"https://api.github.com/users/eric-crowell/orgs","repos_url":"https://api.github.com/users/eric-crowell/repos","events_url":"https://api.github.com/users/eric-crowell/events{/privacy}","received_events_url":"https://api.github.com/users/eric-crowell/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-07-16T19:01:17Z
2023-10-01T02:30:54Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3598/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3598/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3598/timeline
110
https://github.com/reduxjs/redux-toolkit/issues/3583
BugRTKQresponse in providesTags is not currentCachecurrentCache, merge, providesTags1
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/13","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13/labels","id":10275572,"node_id":"MI_kwDOB2ACAs4AnMr0","number":13,"title":"2.x bugfixes","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":6,"state":"open","created_at":"2023-12-06T12:49:04Z","updated_at":"2024-01-21T01:26:46Z","due_on":null,"closed_at":null}
3583
response in providesTags is not currentCache when use with merge, response in here is the result of each request, not results of all requests

I try store.getState(), but it throw an error
```js
providesTags(response, error, {domainId}) {
/**
* response in here is the result of each request, not results of all requests
* so we need get the complete cache
*/
({data: response} = api.endpoints.getMigrations.select({
domainId,
})(store.getState()));

return response
? [
...migrationsAdapter
.getSelectors()
.selectIds(response)
.map((id) => ({
type: TYPE.MIGRATION,
id: JSON.stringify([domainId, id]),
})),
{
type: TYPE.MIGRATION,
id: JSON.stringify([domainId, 'LIST']),
},
]
: [
{
type: TYPE.MIGRATION,
domainId: JSON.stringify([domainId, 'LIST']),
},
];
},
```

<img width="1167" alt="image" src="https://github.com/reduxjs/redux-toolkit/assets/11453989/46bbe47a-e755-4a65-822e-4bb222dfb654">

How to get the complete currentCache in providesTags?
[]
{"login":"grtan","id":11453989,"node_id":"MDQ6VXNlcjExNDUzOTg5","avatar_url":"https://avatars.githubusercontent.com/u/11453989?v=4","gravatar_id":"","url":"https://api.github.com/users/grtan","html_url":"https://github.com/grtan","followers_url":"https://api.github.com/users/grtan/followers","following_url":"https://api.github.com/users/grtan/following{/other_user}","gists_url":"https://api.github.com/users/grtan/gists{/gist_id}","starred_url":"https://api.github.com/users/grtan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grtan/subscriptions","organizations_url":"https://api.github.com/users/grtan/orgs","repos_url":"https://api.github.com/users/grtan/repos","events_url":"https://api.github.com/users/grtan/events{/privacy}","received_events_url":"https://api.github.com/users/grtan/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-07-07T09:45:17Z
2023-12-06T12:49:43Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3583/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3583/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3583/timeline
111
https://github.com/reduxjs/redux-toolkit/issues/3580
BugRTKQRefetchOnMountOrargChange keeps the isFetching always truerefetchOnMount isFetchingnot reproducible?83580
When setting RefetchOnMountOrargChange prop to true in a query, it only works fine on the first render. If i refresh the app, then the query is stuck in the loading state. Nothing special in the code;

` const {data, isFetching, error, refetch} = useMyQuery(user_id, {
refetchOnMountOrArgChange: true,
});`

**EDIT**

This is the whole component;

```import {SectionList, VStack} from 'native-base';
import {FC, useMemo, useState} from 'react';
import {BackHandler} from 'react-native';
import {useSelector} from 'react-redux';
import {
NoBoards,
Sectionheader,
workspaceRenderItem,
} from '../../components/screencomponents/listcomponents';
import {Loader} from '../../components/utils/utils';
import {useGetworkspacesQuery} from '../../store/apislices/boardapislice';
import {useIsReady} from '../../utils/customhooks';
import {errorHandler} from '../../utils/errorhandler';
import {WorkspaceProps, WorkspaceRenderItemProps} from './types';

const WorkSpaces: FC<WorkspaceProps> = ({navigation}) => {
const user_id = useSelector<any, any>((s) => s?.user?._id);

const {data, isFetching, error, refetch} = useGetworkspacesQuery(user_id, {
refetchOnMountOrArgChange: true,
});

useEffect(() => {
if (error) errorHandler(error);
}, [error]);

const allspaces = useMemo(
() => [
{
title: 'My Workspaces',
data: data?.allWorkspaces ?? [],
},
{
title: 'Guest Workspaces',
data: data?.allguestWorkspace ?? [],
},
],
[data],
);

const renderItem = ({item, index, section}: WorkspaceRenderItemProps) => {
let ind = section?.title?.includes('Guest')
? allspaces?.[0]?.data?.length + index
: index;
const onPress = () => {
navigation.navigate('boards', {index: ind});
};

return workspaceRenderItem({item, index: ind, onPress});
};

const notReady = useIsReady();

if (notReady) return <Loader />;
return (
<SectionList
refreshing={isFetching}
onRefresh={refetch}
sections={allspaces ?? []}
renderItem={renderItem}
ListEmptyComponent={
!isFetching ? <NoBoards screenname="workspace" /> : null
}
renderSectionHeader={Sectionheader}
stickySectionHeadersEnabled
ListFooterComponent={<VStack p="5" />}
/>
);
};

export default WorkSpaces;
```
[]
{"login":"Irfanwani","id":62456735,"node_id":"MDQ6VXNlcjYyNDU2NzM1","avatar_url":"https://avatars.githubusercontent.com/u/62456735?v=4","gravatar_id":"","url":"https://api.github.com/users/Irfanwani","html_url":"https://github.com/Irfanwani","followers_url":"https://api.github.com/users/Irfanwani/followers","following_url":"https://api.github.com/users/Irfanwani/following{/other_user}","gists_url":"https://api.github.com/users/Irfanwani/gists{/gist_id}","starred_url":"https://api.github.com/users/Irfanwani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Irfanwani/subscriptions","organizations_url":"https://api.github.com/users/Irfanwani/orgs","repos_url":"https://api.github.com/users/Irfanwani/repos","events_url":"https://api.github.com/users/Irfanwani/events{/privacy}","received_events_url":"https://api.github.com/users/Irfanwani/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-07-05T03:55:58Z
2023-07-12T15:50:02Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3580/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3580/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3580/timeline
112
https://github.com/reduxjs/redux-toolkit/issues/3564
FeatureRTKQFuzzy matching against args in api.util.updateQueryDataupdateQueryData, utils perfBen's comment offers partial coverage3
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3564
Would it be possible to add support for fuzzy matching against args in the utility updateQueryData? There are instances where I want to change on all cached endpoints of a query regardless of what args they are cached on.

For example here the `getTransactions` query also have a `type` argument but I simply do not core what the value is. I only care updating where both companyDomain and planId matches.
```ts
const patchResult = dispatch(
myApi.util.updateQueryData(
"getTransactions",
{ companyDomainId, planId },
(draft) => {
Object.assign(draft, updatedTransactions);
}
)
);
```

I'm thinking of something like how I match objects in vitest: `expect.objectContaining({ companyDomainId, planId, type: expect.any() }),`

My workaround is to just pass everything I need as arguments for this query but it feels a bit cumbersome to have to do it just because I need it on my `onQueryStarted` method.
[]
{"login":"hornta","id":4553604,"node_id":"MDQ6VXNlcjQ1NTM2MDQ=","avatar_url":"https://avatars.githubusercontent.com/u/4553604?v=4","gravatar_id":"","url":"https://api.github.com/users/hornta","html_url":"https://github.com/hornta","followers_url":"https://api.github.com/users/hornta/followers","following_url":"https://api.github.com/users/hornta/following{/other_user}","gists_url":"https://api.github.com/users/hornta/gists{/gist_id}","starred_url":"https://api.github.com/users/hornta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hornta/subscriptions","organizations_url":"https://api.github.com/users/hornta/orgs","repos_url":"https://api.github.com/users/hornta/repos","events_url":"https://api.github.com/users/hornta/events{/privacy}","received_events_url":"https://api.github.com/users/hornta/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-06-29T06:57:18Z
2023-12-06T14:06:26Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3564/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3564/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3564/timeline
113
https://github.com/reduxjs/redux-toolkit/issues/3553
FeatureDocs, RTKQ-Code-Genrtk-query-codegen-openapi: FilterEndpoints ambiguous matches OperationId FilterEndpoints requested better docs13553

## Context
I used the `filterEndpoint` in the configuration for `[rtk-query-codegen-openapi](https://github.com/reduxjs/redux-toolkit/tree/master/packages/rtk-query-codegen-openapi)` like this:
```
filterEndpoints: [/^clientapps/],
```

## Problem

**Expected behavior:** The endpoints are filtered by their path according to the regex.
**Actual behavior:** The endpoints are filtered by `operationId` if given.

What is even more concerning to me is that some camel case magic is happening in the background. My controller had operationId `ProjectClientApps_create` but did not match to the regexp. I fixed it by using the regex `/^userClientApp/`.

## Suggested Solution

Also match for the API path.


## Disclaimer

I'm not sure if this really is a bug or intended behavior. Please treat this issue as documentation if it is not a bug. It took me forever to debug into the library to understand what's happening ;-)

[]
{"login":"georg-schwarz","id":28054628,"node_id":"MDQ6VXNlcjI4MDU0NjI4","avatar_url":"https://avatars.githubusercontent.com/u/28054628?v=4","gravatar_id":"","url":"https://api.github.com/users/georg-schwarz","html_url":"https://github.com/georg-schwarz","followers_url":"https://api.github.com/users/georg-schwarz/followers","following_url":"https://api.github.com/users/georg-schwarz/following{/other_user}","gists_url":"https://api.github.com/users/georg-schwarz/gists{/gist_id}","starred_url":"https://api.github.com/users/georg-schwarz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georg-schwarz/subscriptions","organizations_url":"https://api.github.com/users/georg-schwarz/orgs","repos_url":"https://api.github.com/users/georg-schwarz/repos","events_url":"https://api.github.com/users/georg-schwarz/events{/privacy}","received_events_url":"https://api.github.com/users/georg-schwarz/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-06-22T15:53:07Z
2023-10-19T15:26:48Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3553/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3553/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3553/timeline
115
https://github.com/reduxjs/redux-toolkit/issues/3517
FeatureRTKQI would like to know the plan for React Suspense with RTK Query 2.0React-SuspenseGood discussion, mark links vercels standalones for react-suspense63517
https://github.com/reduxjs/redux-toolkit/discussions/2797#discussioncomment-4396073
I prefer RTK.
However, I would also like to use Suspense.
Will Suspense be supported in RTK 2.0?
I couldn't find any issues etc. that mention it.
[]
{"login":"kahirokunn","id":22343391,"node_id":"MDQ6VXNlcjIyMzQzMzkx","avatar_url":"https://avatars.githubusercontent.com/u/22343391?v=4","gravatar_id":"","url":"https://api.github.com/users/kahirokunn","html_url":"https://github.com/kahirokunn","followers_url":"https://api.github.com/users/kahirokunn/followers","following_url":"https://api.github.com/users/kahirokunn/following{/other_user}","gists_url":"https://api.github.com/users/kahirokunn/gists{/gist_id}","starred_url":"https://api.github.com/users/kahirokunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kahirokunn/subscriptions","organizations_url":"https://api.github.com/users/kahirokunn/orgs","repos_url":"https://api.github.com/users/kahirokunn/repos","events_url":"https://api.github.com/users/kahirokunn/events{/privacy}","received_events_url":"https://api.github.com/users/kahirokunn/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-06-10T00:15:58Z
2023-08-25T18:07:21Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3517/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3517/reactions","total_count":3,"+1":3,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3517/timeline
116
https://github.com/reduxjs/redux-toolkit/issues/3508
FeatureNext, RTKQRTK Query and Next 13 `app` dir / React Server components: status and discussionReact-SuspensePinned Issue, might be worth fancying up8
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3508
We're getting a lot of questions about whether RTK Query works with RSCs.

Quoting Lenz at https://twitter.com/phry/status/1666553972075687938 :

> There's a lot of nuance. In client components, it effectively already works, but not for SSR. In RSC, it's probably not a particularly useful/good idea. In Client component SSR we need support for two things: streaming SSR data transport and a good suspense story.
>
> Of those last two things, the first right now can only be solved in a very unsatisfying way with a Next-specific api. The latter would probably build on top of `use`, but it would be a "temporary" api design until React would add use support for observables (if they ever do).

We're also looking at tweaking RTKQ + React-Redux to not throw errors related to calling `createContext` in an RSC environment.
[]
{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false}
COLLABORATORopenFALSE
2023-06-07T21:21:18Z
2023-12-16T07:31:53Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3508/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3508/reactions","total_count":14,"+1":13,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":1}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3508/timeline
117
https://github.com/reduxjs/redux-toolkit/issues/3468
FeatureRTKQ-Code-Genrtk-query-codegen-openapi auth (custom headers for swagger url)swagger-optionsAuth header handling is a common request it seems03468
## Problem
I can't parse swagger schema with authorization required url

## Solution

Would be great if i can pass headers or control auth in config file

https://github.com/reduxjs/redux-toolkit/blob/e92993813a95d9165e0df77cf52573d6021a6fa8/packages/rtk-query-codegen-openapi/src/index.ts#L14-L17

https://github.com/reduxjs/redux-toolkit/blob/e92993813a95d9165e0df77cf52573d6021a6fa8/packages/rtk-query-codegen-openapi/src/generate.ts#L97

https://github.com/reduxjs/redux-toolkit/blob/e92993813a95d9165e0df77cf52573d6021a6fa8/packages/rtk-query-codegen-openapi/src/utils/getV3Doc.ts#L8

https://github.com/APIDevTools/swagger-parser/blob/main/docs/swagger-parser.md#bundleapi-options-callback

> bundle(api, [options], [callback])
api (required) - string or object
A [Swagger Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object), or the file path or URL of your Swagger API. See the [parse](https://github.com/APIDevTools/swagger-parser/blob/main/docs/swagger-parser.md#parseapi-options-callback) method for more info.

> options (optional) - object
See [options](https://github.com/APIDevTools/swagger-parser/blob/main/docs/options.md) for the full list of options

https://github.com/APIDevTools/swagger-parser/blob/main/docs/options.md#resolve-options

> http.headers - You can specify any HTTP headers that should be sent when downloading files. For example, some servers may require you to set the Accept or Referrer header.


[]
{"login":"Mozzarella123","id":22841455,"node_id":"MDQ6VXNlcjIyODQxNDU1","avatar_url":"https://avatars.githubusercontent.com/u/22841455?v=4","gravatar_id":"","url":"https://api.github.com/users/Mozzarella123","html_url":"https://github.com/Mozzarella123","followers_url":"https://api.github.com/users/Mozzarella123/followers","following_url":"https://api.github.com/users/Mozzarella123/following{/other_user}","gists_url":"https://api.github.com/users/Mozzarella123/gists{/gist_id}","starred_url":"https://api.github.com/users/Mozzarella123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mozzarella123/subscriptions","organizations_url":"https://api.github.com/users/Mozzarella123/orgs","repos_url":"https://api.github.com/users/Mozzarella123/repos","events_url":"https://api.github.com/users/Mozzarella123/events{/privacy}","received_events_url":"https://api.github.com/users/Mozzarella123/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-05-23T10:20:18Z
2023-05-23T10:20:18Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3468/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3468/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3468/timeline
118
https://github.com/reduxjs/redux-toolkit/issues/3452
BugRTKQUnder what circumstances would the rtk query mutation result keeps pending even the request has succeeded mutationsCould be related to #397983452
Hi I've met one situation that the request has got the response successfully but the mutation result keeps pending.

JUST WONDERING :

Under what circumstances would the RTK query mutation result keeps pending even the request has succeeded
[]
{"login":"Victor716","id":25873924,"node_id":"MDQ6VXNlcjI1ODczOTI0","avatar_url":"https://avatars.githubusercontent.com/u/25873924?v=4","gravatar_id":"","url":"https://api.github.com/users/Victor716","html_url":"https://github.com/Victor716","followers_url":"https://api.github.com/users/Victor716/followers","following_url":"https://api.github.com/users/Victor716/following{/other_user}","gists_url":"https://api.github.com/users/Victor716/gists{/gist_id}","starred_url":"https://api.github.com/users/Victor716/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Victor716/subscriptions","organizations_url":"https://api.github.com/users/Victor716/orgs","repos_url":"https://api.github.com/users/Victor716/repos","events_url":"https://api.github.com/users/Victor716/events{/privacy}","received_events_url":"https://api.github.com/users/Victor716/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-05-17T08:22:52Z
2023-05-18T02:59:12Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3452/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3452/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3452/timeline
119
https://github.com/reduxjs/redux-toolkit/issues/3450
FeatureRTKQ[RED-18] Export buildHooks functionbuildHooks export2
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3450
I have a specific use case, where I'm using redux-toolkit through module federation, so all my micro-frontends can access it. The problem is that every micro-frontend has its own React instance, and the exported hooks from the ReactModule won't work as we can't call one Hook from different React versions.

My current solution is basically copying and pasting the code from the `buildQueryHooks` and `buildMutationHooks` functions, but it would make everything way cleaner if the function `buildHooks` were available!

Thanks for reading

Edit: Already created a PR since it's a really small change: https://github.com/reduxjs/redux-toolkit/pull/3451

<sub>[RED-18](https://linear.app/redux/issue/RED-18/export-buildhooks-function)</sub>
[{"id":5992985876,"node_id":"LA_kwDOB2ACAs8AAAABZTW1FA","url":"https://api.github.com/repos/reduxjs/redux-toolkit/labels/linear","name":"linear","color":"4941DA","default":false,"description":"Created by Linear-GitHub Sync"}]
{"login":"lucashm","id":16053704,"node_id":"MDQ6VXNlcjE2MDUzNzA0","avatar_url":"https://avatars.githubusercontent.com/u/16053704?v=4","gravatar_id":"","url":"https://api.github.com/users/lucashm","html_url":"https://github.com/lucashm","followers_url":"https://api.github.com/users/lucashm/followers","following_url":"https://api.github.com/users/lucashm/following{/other_user}","gists_url":"https://api.github.com/users/lucashm/gists{/gist_id}","starred_url":"https://api.github.com/users/lucashm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucashm/subscriptions","organizations_url":"https://api.github.com/users/lucashm/orgs","repos_url":"https://api.github.com/users/lucashm/repos","events_url":"https://api.github.com/users/lucashm/events{/privacy}","received_events_url":"https://api.github.com/users/lucashm/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-05-16T21:35:42Z
2023-10-01T02:31:02Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3450/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3450/reactions","total_count":1,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":1}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3450/timeline
121
https://github.com/reduxjs/redux-toolkit/issues/3395
BugTS, RTKQ-Code-GenRTKQ - OpenAPI Codegen - Support for TS 5TS v5 compatibilitypotentially not a bug still or necessary23395
Hi,

Having browsed a bit in your issue queue, I can't find anything that mentions OpenAPI codegen and TS v5 compatibility.

Currently, the codegen package supports TS up to v4.5.

Is there any plan in place for bumping the TS dependency to v5?
And if not - is there anything I can do to get there?

BR Alex

[]
{"login":"akrrev","id":117973016,"node_id":"U_kgDOBwggGA","avatar_url":"https://avatars.githubusercontent.com/u/117973016?v=4","gravatar_id":"","url":"https://api.github.com/users/akrrev","html_url":"https://github.com/akrrev","followers_url":"https://api.github.com/users/akrrev/followers","following_url":"https://api.github.com/users/akrrev/following{/other_user}","gists_url":"https://api.github.com/users/akrrev/gists{/gist_id}","starred_url":"https://api.github.com/users/akrrev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akrrev/subscriptions","organizations_url":"https://api.github.com/users/akrrev/orgs","repos_url":"https://api.github.com/users/akrrev/repos","events_url":"https://api.github.com/users/akrrev/events{/privacy}","received_events_url":"https://api.github.com/users/akrrev/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-04-21T14:27:46Z
2023-05-09T13:10:24Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3395/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3395/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3395/timeline
122
https://github.com/reduxjs/redux-toolkit/issues/3394
Bug, QuestionDocs, RTKQRTKQ resetApiState is not properly resetting queries when skip=trueresetApiState skipQuestion or Bug depending on intended behaviour13394
https://codesandbox.io/s/musing-bohr-zvcfri?file=/src/App.js

1. I load the sandbox, the pokemon is fetched.
2. I toggle skip (skip is true), the results will vanish.
3. I reset the API state.
4. Now I toggle skip again (skip is false).

I would expect that (because I made a reset of the API state) that there is no cached data. However, there is.

The documentation of [resetApiState states](https://redux-toolkit.js.org/rtk-query/api/created-api/api-slice-utils#resetapistate) that
"Note that [hooks](https://redux-toolkit.js.org/rtk-query/api/created-api/hooks) also track state in local component state and might not fully be reset by resetApiState.".

Maybe my confusion can be explained with this - so I'm not quite sure if the above is really a bug or intended behavior.
[]
{"login":"RRaideRR","id":3411292,"node_id":"MDQ6VXNlcjM0MTEyOTI=","avatar_url":"https://avatars.githubusercontent.com/u/3411292?v=4","gravatar_id":"","url":"https://api.github.com/users/RRaideRR","html_url":"https://github.com/RRaideRR","followers_url":"https://api.github.com/users/RRaideRR/followers","following_url":"https://api.github.com/users/RRaideRR/following{/other_user}","gists_url":"https://api.github.com/users/RRaideRR/gists{/gist_id}","starred_url":"https://api.github.com/users/RRaideRR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RRaideRR/subscriptions","organizations_url":"https://api.github.com/users/RRaideRR/orgs","repos_url":"https://api.github.com/users/RRaideRR/repos","events_url":"https://api.github.com/users/RRaideRR/events{/privacy}","received_events_url":"https://api.github.com/users/RRaideRR/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-04-21T13:34:48Z
2023-09-11T19:49:09Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3394/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3394/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3394/timeline
123
https://github.com/reduxjs/redux-toolkit/issues/3369
BugRTKQ-Code-GenOpenapi-codegen doesn’t handle discriminated union properlydiscriminated union handling03369
In our OpenAPI specification, we have a type `Allowance` that can be either a `EngineeringAllowance` or `StandardAllowance`.

we use the property `allowance_type` as discriminator.

```yaml
Allowance:
oneOf:
- $ref: "#/components/schemas/EngineeringAllowance"
- $ref: "#/components/schemas/StandardAllowance"
discriminator:
propertyName: allowance_type
```

each allowance type correspond to one `allowance_type` string, as given by the enum

```yaml
StandardAllowance:
properties:
allowance_type:
type: string
enum: ["standard"]
```

The types generated by `rtk-query/codegen-openapi` isn’t correct,

the type `Allowance` is empty. The discrimated union never match the given patterns `allowance_type: 'EngineeringAllowance';` or `allowance_type: 'StandardAllowance';` as it’s the wrong strings.

the strings do not match with the value given in the openAPI definition, it simply uses the name of the Schema.

It should use the provided `allowance_type` strings given in the `allowance_type` enum for each schema.

```ts
export type EngineeringAllowance = {
allowance_type?: 'engineering';
distribution?: 'MARECO' | 'LINEAR';
capacity_speed_limit?: number;
} & RangeAllowance;
export type StandardAllowance = {
allowance_type?: 'standard';
default_value?: AllowanceValue;
ranges?: RangeAllowance[];
distribution?: 'MARECO' | 'LINEAR';
capacity_speed_limit?: number;
};
export type Allowance =
| ({
allowance_type: 'EngineeringAllowance';
} & EngineeringAllowance)
| ({
allowance_type: 'StandardAllowance';
} & StandardAllowance);
```

```yaml
Allowance:
oneOf:
- $ref: "#/components/schemas/EngineeringAllowance"
- $ref: "#/components/schemas/StandardAllowance"
discriminator:
propertyName: allowance_type

StandardAllowance:
properties:
allowance_type:
type: string
enum: ["standard"]
default_value:
$ref: "#/components/schemas/AllowanceValue"
ranges:
type: array
items:
$ref: "#/components/schemas/RangeAllowance"
distribution:
type: string
enum: ["MARECO", "LINEAR"]
capacity_speed_limit:
type: number
format: double

EngineeringAllowance:
allOf:
- type: object
properties:
allowance_type:
type: string
enum: ["engineering"]
distribution:
type: string
enum: ["MARECO", "LINEAR"]
capacity_speed_limit:
type: number
format: double
- $ref: "#/components/schemas/RangeAllowance"
```
[]
{"login":"anisometropie","id":24652545,"node_id":"MDQ6VXNlcjI0NjUyNTQ1","avatar_url":"https://avatars.githubusercontent.com/u/24652545?v=4","gravatar_id":"","url":"https://api.github.com/users/anisometropie","html_url":"https://github.com/anisometropie","followers_url":"https://api.github.com/users/anisometropie/followers","following_url":"https://api.github.com/users/anisometropie/following{/other_user}","gists_url":"https://api.github.com/users/anisometropie/gists{/gist_id}","starred_url":"https://api.github.com/users/anisometropie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anisometropie/subscriptions","organizations_url":"https://api.github.com/users/anisometropie/orgs","repos_url":"https://api.github.com/users/anisometropie/repos","events_url":"https://api.github.com/users/anisometropie/events{/privacy}","received_events_url":"https://api.github.com/users/anisometropie/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-04-17T15:01:21Z
2023-04-18T07:37:28Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3369/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3369/reactions","total_count":2,"+1":2,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3369/timeline
124
https://github.com/reduxjs/redux-toolkit/issues/3365
FeatureDocs, Example, RTK, RTKQAdd more CI build example projectsCI build examples13365Ideas:

- Various TS module resolution formats
- React Native (Metro? Expo?)
- Deno
- RTKQ performance?
[]
{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false}
COLLABORATORopenFALSE
2023-04-17T01:55:55Z
2023-09-17T00:30:24Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3365/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3365/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3365/timeline
125
https://github.com/reduxjs/redux-toolkit/issues/3360
FeatureRTKQSelectResponse for createApi queries cache evaluation0
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/12","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/12/labels","id":9986560,"node_id":"MI_kwDOB2ACAs4AmGIA","number":12,"title":"Post 2.0","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":7,"state":"open","created_at":"2023-10-01T02:30:13Z","updated_at":"2024-01-21T16:59:27Z","due_on":null,"closed_at":null}
3360
Currently createAPI supports using a stable cache key for queries, and suggests storing the data in some transformed form to allow easily adding new data to the cache. This allows a user to request data from multiple pages without loosing the previous page.

Currently however (as far as I can tell) the response from the redux hooks always returns the transformed data, ie if the user requests
?first=10&offset=0
and then
?first=10&offset=10
They will receive the first 20 data points and will have to introduce logic inside the component to select the right data.

If a new selectResponse method was added to the query builder the data returned from the hook could be modified based on the queries to select only the relevant data from the cache. This would mean the user of the generated hooks would not need to worry about selecting the relevant data from the hooks, and also allow us to hide the cache logic from the user.

It is of course possible to use a separate cache entry for each query, but this has several downsides
- we have to fetch data twice if we have several overlapping queries, ie
?first=20&offset=0
?first=10&offset=0
- if we go to the next page and then back we unsubscribe from the first query, and possibly loose the data (we want to unsubscribe only when the user is no longer looking at any page)
[]
{"login":"Matt-Ord","id":55235095,"node_id":"MDQ6VXNlcjU1MjM1MDk1","avatar_url":"https://avatars.githubusercontent.com/u/55235095?v=4","gravatar_id":"","url":"https://api.github.com/users/Matt-Ord","html_url":"https://github.com/Matt-Ord","followers_url":"https://api.github.com/users/Matt-Ord/followers","following_url":"https://api.github.com/users/Matt-Ord/following{/other_user}","gists_url":"https://api.github.com/users/Matt-Ord/gists{/gist_id}","starred_url":"https://api.github.com/users/Matt-Ord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Matt-Ord/subscriptions","organizations_url":"https://api.github.com/users/Matt-Ord/orgs","repos_url":"https://api.github.com/users/Matt-Ord/repos","events_url":"https://api.github.com/users/Matt-Ord/events{/privacy}","received_events_url":"https://api.github.com/users/Matt-Ord/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-04-15T07:51:29Z
2023-12-06T14:04:20Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3360/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3360/reactions","total_count":1,"+1":1,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3360/timeline
127
https://github.com/reduxjs/redux-toolkit/issues/3353BugRTKQisSuccess flashes false on subsequent queriesisSuccess buildHook43353
Given a basic component like the one below, `response.isSuccess` flashes false on subsequent queries.

**Basic Example**
```jsx
import { useState } from "react";
import api from "./api";

export default function App() {
const [params, setParams] = useState({ req: 0 });
const response = api.useSearchQuery(params);

console.log(
`request: ${params.req}\tisFetching: ${response.isFetching}\tisSuccess: ${response.isSuccess}`
);

return (
<div>
<button
disabled={response.isFetching}
onClick={() => setParams({ req: params.req + 1 })}
>
Refresh
</button>
<pre>{JSON.stringify(response, undefined, 3)}</pre>
</div>
);
}
```

**Current Behavior in Console Log**
```
request: 0 isFetching: true isSuccess: false
request: 0 isFetching: true isSuccess: false
request: 0 isFetching: false isSuccess: true
request: 1 isFetching: true isSuccess: false <--
request: 1 isFetching: true isSuccess: true
request: 1 isFetching: false isSuccess: true
```

**Expected Behavior in Console Log**

Given this quote from the [documentation](https://redux-toolkit.js.org/rtk-query/usage/queries#frequently-used-query-hook-return-values):
> isSuccess - When true, indicates that the query has data from a successful request.

I would expect `isSuccess` to remain `true` while `data` is not `undefined`.
```
request: 0 isFetching: true isSuccess: false
request: 0 isFetching: true isSuccess: false
request: 0 isFetching: false isSuccess: true
request: 1 isFetching: true isSuccess: true <--
request: 1 isFetching: true isSuccess: true
request: 1 isFetching: false isSuccess: true
```

**Repo to Reproduce**:
https://github.com/kellengreen/rtk
[]
{"login":"kellengreen","id":1750507,"node_id":"MDQ6VXNlcjE3NTA1MDc=","avatar_url":"https://avatars.githubusercontent.com/u/1750507?v=4","gravatar_id":"","url":"https://api.github.com/users/kellengreen","html_url":"https://github.com/kellengreen","followers_url":"https://api.github.com/users/kellengreen/followers","following_url":"https://api.github.com/users/kellengreen/following{/other_user}","gists_url":"https://api.github.com/users/kellengreen/gists{/gist_id}","starred_url":"https://api.github.com/users/kellengreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kellengreen/subscriptions","organizations_url":"https://api.github.com/users/kellengreen/orgs","repos_url":"https://api.github.com/users/kellengreen/repos","events_url":"https://api.github.com/users/kellengreen/events{/privacy}","received_events_url":"https://api.github.com/users/kellengreen/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-04-13T22:44:03Z
2023-12-07T23:38:01Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3353/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3353/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3353/timeline
128
https://github.com/reduxjs/redux-toolkit/issues/3350
Feature, Discussion
RTKQrtk-query: endpoint name clashes in a big appinjectEndpoints conflicts103350
I'm converting a fairly big app to rtk-q. the app is heavily split into "features" and each feature is lazy-loaded, so we're using `injectEndpoints`. Different features are developed by different teams so it was just a matter of time before we started getting endpoint clashes with different features having something like `useFetchDataQuery` or `useUpdateDataMutation`

Do you think we can do something about it? :) Like add an optional `key` to `injectEndpoints`?

~Additionally, I don't fully understand the `overrideExisting` option. With it being false by default it was rather surprising and tricky to track down why a wrong network call was suddenly made in a different part of the app.~ ok according to the doc it should've warned me in dev env, but for some reason it didn't

Frankly, I don't really understand the use case of either `overrideExisting` set to true _or_ false. Why would it be ok to disregard the fact that the endpoint names clash?
[]
{"login":"dreyks","id":1481264,"node_id":"MDQ6VXNlcjE0ODEyNjQ=","avatar_url":"https://avatars.githubusercontent.com/u/1481264?v=4","gravatar_id":"","url":"https://api.github.com/users/dreyks","html_url":"https://github.com/dreyks","followers_url":"https://api.github.com/users/dreyks/followers","following_url":"https://api.github.com/users/dreyks/following{/other_user}","gists_url":"https://api.github.com/users/dreyks/gists{/gist_id}","starred_url":"https://api.github.com/users/dreyks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreyks/subscriptions","organizations_url":"https://api.github.com/users/dreyks/orgs","repos_url":"https://api.github.com/users/dreyks/repos","events_url":"https://api.github.com/users/dreyks/events{/privacy}","received_events_url":"https://api.github.com/users/dreyks/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-04-13T15:56:36Z
2024-01-19T10:19:33Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3350/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3350/reactions","total_count":3,"+1":3,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3350/timeline
130
https://github.com/reduxjs/redux-toolkit/issues/3322QuestionRTKQ[How to] Poll until data has status != in-progresssubscriptions, polling03322

# Problem

There is data that need to be polled if the result is still in progress

I want to do that polling in the `injectEndpoints` configuration rather than in a hook. (maybe its not a good idea)

```
onCacheEntryAdded: async (arg, api) => {
// On query receieved, if its still in progress, start polling
try {
const data = await api.cacheDataLoaded;

if (
data.data.inferences.some(
(inference) => inference.status === "in-progress"
)
)
{
console.log("Found queries in progress, start the polling");
// await api.dispatch(
// apiSlice.endpoints.getInferences.initiate(arg, {
// subscriptionOptions: { pollingInterval: 3000 },
// })
// );
}
else {
console.log("No queries in progress, stop the polling if it was started");
// Stop the polling

}
} catch (error) {}
await api.cacheEntryRemoved;
console.log("stop the polling");
// Stop the polling

},
```

Here I do not manage to find the right set of `api.X` or `sliceApi.X` to start the poll or stop it if needed.

[]
{"login":"adelin-b","id":23508913,"node_id":"MDQ6VXNlcjIzNTA4OTEz","avatar_url":"https://avatars.githubusercontent.com/u/23508913?v=4","gravatar_id":"","url":"https://api.github.com/users/adelin-b","html_url":"https://github.com/adelin-b","followers_url":"https://api.github.com/users/adelin-b/followers","following_url":"https://api.github.com/users/adelin-b/following{/other_user}","gists_url":"https://api.github.com/users/adelin-b/gists{/gist_id}","starred_url":"https://api.github.com/users/adelin-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adelin-b/subscriptions","organizations_url":"https://api.github.com/users/adelin-b/orgs","repos_url":"https://api.github.com/users/adelin-b/repos","events_url":"https://api.github.com/users/adelin-b/events{/privacy}","received_events_url":"https://api.github.com/users/adelin-b/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-04-03T19:41:07Z
2023-04-03T19:41:07Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3322/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3322/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3322/timeline
131
https://github.com/reduxjs/redux-toolkit/issues/3314
FeatureRTKQExtend ForkedTaskApi to include APIForkedTaskApi3
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13","html_url":"https://github.com/reduxjs/redux-toolkit/milestone/13","labels_url":"https://api.github.com/repos/reduxjs/redux-toolkit/milestones/13/labels","id":10275572,"node_id":"MI_kwDOB2ACAs4AnMr0","number":13,"title":"2.x bugfixes","description":"","creator":{"login":"markerikson","id":1128784,"node_id":"MDQ6VXNlcjExMjg3ODQ=","avatar_url":"https://avatars.githubusercontent.com/u/1128784?v=4","gravatar_id":"","url":"https://api.github.com/users/markerikson","html_url":"https://github.com/markerikson","followers_url":"https://api.github.com/users/markerikson/followers","following_url":"https://api.github.com/users/markerikson/following{/other_user}","gists_url":"https://api.github.com/users/markerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/markerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markerikson/subscriptions","organizations_url":"https://api.github.com/users/markerikson/orgs","repos_url":"https://api.github.com/users/markerikson/repos","events_url":"https://api.github.com/users/markerikson/events{/privacy}","received_events_url":"https://api.github.com/users/markerikson/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":6,"state":"open","created_at":"2023-12-06T12:49:04Z","updated_at":"2024-01-21T01:26:46Z","due_on":null,"closed_at":null}
3314
Having considered porting a lot of code from saga to listeners, I've noticed that I am reaching for the same pattern which is a bit verbose in order to have deeply nested forking:

Example:
```js
function doThingEvent(action, api) {
const forks = [];
await api.pause(
api.fork((forkApi) => doAnotherThing({ api, ...forkApi }))
);
}
```

When in reality, the `ForkedTaskApi` could just include things from the parent, like `getState()`, `dispatch()`, and `fork()`. Not only would this make the code easier to read `api.fork(doAnotherThing))`, but it would also mean the type API for both the fork and the task is the same.
[]
{"login":"ericanderson","id":120899,"node_id":"MDQ6VXNlcjEyMDg5OQ==","avatar_url":"https://avatars.githubusercontent.com/u/120899?v=4","gravatar_id":"","url":"https://api.github.com/users/ericanderson","html_url":"https://github.com/ericanderson","followers_url":"https://api.github.com/users/ericanderson/followers","following_url":"https://api.github.com/users/ericanderson/following{/other_user}","gists_url":"https://api.github.com/users/ericanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/ericanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericanderson/subscriptions","organizations_url":"https://api.github.com/users/ericanderson/orgs","repos_url":"https://api.github.com/users/ericanderson/repos","events_url":"https://api.github.com/users/ericanderson/events{/privacy}","received_events_url":"https://api.github.com/users/ericanderson/received_events","type":"User","site_admin":false}
CONTRIBUTORopenFALSE
2023-03-31T17:51:50Z
2023-12-06T12:49:42Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3314/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3314/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3314/timeline
132
https://github.com/reduxjs/redux-toolkit/issues/3303BugRTKQ-Code-GenCodegen allow path parameters without them being specified in pathparams03303
for example openapi specification like this

```
/messages:
put:
operationId: updateMessage
parameters:
- $ref: "#/components/parameters/messageIdPath"

components:
parameters:
messageIdPath:
name: id
in: path
required: true
schema:
type: string
```

will generate endpoint like this

```
updateMessage: build.mutation<UpdateMessageApiResponse, UpdateMessageApiArg>({
query: (queryArg) => ({ url: '/messages', method: 'PUT', body: queryArg.message }),
}),

export type UpdateMessageApiArg = {
id: string;
message: Message;
};
```

The path id is in generated ApiArgs but not in the url and this is not what is wanted.

I think it would be better just to fail the generation and inform that openapi specification is incorrect, the "id" parameter is not specified in path.

openapi specification should be:
```
/messages/{id}:
put:
operationId: updateMessage
parameters:
- $ref: "#/components/parameters/messageIdPath"
```

This will generate correct endpoint like this
```
updateMessage: build.mutation<UpdateMessageApiResponse, UpdateMessageApiArg>({
query: (queryArg) => ({ url: `/messages/${queryArg.id}`, method: 'PUT', body: queryArg.message }),
}),
```
[]
{"login":"henkkasoft","id":28624143,"node_id":"MDQ6VXNlcjI4NjI0MTQz","avatar_url":"https://avatars.githubusercontent.com/u/28624143?v=4","gravatar_id":"","url":"https://api.github.com/users/henkkasoft","html_url":"https://github.com/henkkasoft","followers_url":"https://api.github.com/users/henkkasoft/followers","following_url":"https://api.github.com/users/henkkasoft/following{/other_user}","gists_url":"https://api.github.com/users/henkkasoft/gists{/gist_id}","starred_url":"https://api.github.com/users/henkkasoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henkkasoft/subscriptions","organizations_url":"https://api.github.com/users/henkkasoft/orgs","repos_url":"https://api.github.com/users/henkkasoft/repos","events_url":"https://api.github.com/users/henkkasoft/events{/privacy}","received_events_url":"https://api.github.com/users/henkkasoft/received_events","type":"User","site_admin":false}
NONEopenFALSE
2023-03-28T08:25:47Z
2023-03-28T08:25:47Z
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3303/events
[]
{"url":"https://api.github.com/repos/reduxjs/redux-toolkit/issues/3303/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0}
https://api.github.com/repos/reduxjs/redux-toolkit/issues/3303/timeline