reduxjs/redux-toolkit (@reduxjs/toolkit)
### [`v2.3.0`](https://redirect.github.com/reduxjs/redux-toolkit/releases/tag/v2.3.0)
[Compare Source](https://redirect.github.com/reduxjs/redux-toolkit/compare/v2.2.8...v2.3.0)
This **feature release** adds a new RTK Query `upsertQueryEntries` util to batch-upsert cache entries more efficiently, passes through additional values for use in `prepareHeaders`, and exports additional TS types around query options and selectors.
#### Changelog
##### `upsertQueryEntries`
RTK Query already had an `upsertQueryData` thunk that would upsert a single cache entry. However, some users wanted to upsert *many* cache entries (potentially hundreds or thousands), and found that `upsertQueryData` had poor performance in those cases. This is because `upsertQueryData` runs the full async request handling sequence, including dispatching both `pending` and `fulfilled` actions, each of which run the main reducer and update store subscribers. That means there's `2N` store / UI updates per item, so upserting hundreds of items becomes extremely perf-intensive.
RTK Query now includes an `api.util.upsertQueryEntries` action that is meant to handle the batched upsert use case more efficiently. It's a single synchronous action that accepts an array of many `{endpointName, arg, value}` entries to upsert. This results in a single store update, making this vastly better for performance vs many individual `upsertQueryData` calls.
We see this as having two main use cases. The first is prefilling the cache with data retrieved from storage on app startup (and it's worth noting that `upsertQueryEntries` can accept entries for many different endpoints as part of the same array).
The second is to act as a "pseudo-normalization" tool. [RTK Query is *not* a "normalized" cache](https://redux-toolkit.js.org/rtk-query/usage/cache-behavior#no-normalized-or-de-duplicated-cache). However, there are times when you may want to prefill other cache entries with the contents of another endpoint, such as taking the results of a `getPosts` list endpoint response and prefilling the individual `getPost(id)` endpoint cache entries, so that components that reference an individual item endpoint already have that data available.
Currently, you can implement the "pseudo-normalization" approach by dispatching `upsertQueryEntries` in an endpoint lifecycle, like this:
```ts
const api = createApi({
endpoints: (build) => ({
getPosts: build.query({
query: () => '/posts',
async onQueryStarted(_, { dispatch, queryFulfilled }) {
const res = await queryFulfilled
const posts = res.data
// Pre-fill the individual post entries with the results
// from the list endpoint query
dispatch(
api.util.upsertQueryEntries(
posts.map((post) => ({
endpointName: 'getPost',
arg: { id: post.id },
value: post,
})),
),
)
},
}),
getPost: build.query>({
query: (post) => `post/${post.id}`,
}),
}),
})
```
Down the road we may add a new option to query endpoints that would let you provide the mapping function and have it automatically update the corresponding entries.
For additional comparisons between `upsertQueryData` and `upsertQueryEntries`, see [the `upsertQueryEntries` API reference](https://redux-toolkit.js.org/rtk-query/api/created-api/api-slice-utils#upsertqueryentries).
##### `prepareHeaders` Options
The [`prepareHeaders` callback for `fetchBaseQuery`](https://redux-toolkit.js.org/rtk-query/api/fetchBaseQuery#prepareheaders) now receives two additional values in the `api` argument:
- `arg`: the URL string or `FetchArgs` object that was passed in to `fetchBaseQuery` for this endpoint
- `extraOptions`: any extra options that were provided to the base query
##### Additional TS Types
We've added a `TypedQueryStateSelector` type that can be used to pre-type selectors for use with `selectFromResult`:
```ts
const typedSelectFromResult: TypedQueryStateSelector<
PostsApiResponse,
QueryArgument,
BaseQueryFunction,
SelectedResult
> = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })
function PostsList() {
const { posts } = useGetPostsQuery(undefined, {
selectFromResult: typedSelectFromResult,
})
}
```
We've also exported several additional TS types around base queries and tag definitions.
#### What's Changed
- Fix serializeQueryArgs type by [@Reedgern](https://redirect.github.com/Reedgern) in [https://github.com/reduxjs/redux-toolkit/pull/4658](https://redirect.github.com/reduxjs/redux-toolkit/pull/4658)
- Add the `TypedQueryStateSelector` helper type by [@aryaemami59](https://redirect.github.com/aryaemami59) in [https://github.com/reduxjs/redux-toolkit/pull/4656](https://redirect.github.com/reduxjs/redux-toolkit/pull/4656)
- Pass query args to prepareHeaders function by [@kyletsang](https://redirect.github.com/kyletsang) in [https://github.com/reduxjs/redux-toolkit/pull/4638](https://redirect.github.com/reduxjs/redux-toolkit/pull/4638)
- Implement a util function to batch-upsert cache entries by [@markerikson](https://redirect.github.com/markerikson) in [https://github.com/reduxjs/redux-toolkit/pull/4561](https://redirect.github.com/reduxjs/redux-toolkit/pull/4561)
- fetchBaseQuery: expose extraOptions to prepareHeaders by [@phryneas](https://redirect.github.com/phryneas) in [https://github.com/reduxjs/redux-toolkit/pull/4291](https://redirect.github.com/reduxjs/redux-toolkit/pull/4291)
**Full Changelog**: https://github.com/reduxjs/redux-toolkit/compare/v2.2.8...v2.3.0
taskforcesh/bullmq (bullmq)
### [`v5.21.1`](https://redirect.github.com/taskforcesh/bullmq/releases/tag/v5.21.1)
[Compare Source](https://redirect.github.com/taskforcesh/bullmq/compare/v5.21.0...v5.21.1)
##### Bug Fixes
- **scripts:** add missing wait in isJobInList ([9ef865c](https://redirect.github.com/taskforcesh/bullmq/commit/9ef865c7de6086cb3c906721fd046aeed1e0d27f))
### [`v5.21.0`](https://redirect.github.com/taskforcesh/bullmq/releases/tag/v5.21.0)
[Compare Source](https://redirect.github.com/taskforcesh/bullmq/compare/v5.20.1...v5.21.0)
##### Features
- **queue:** add option to skip metas update ([b7dd925](https://redirect.github.com/taskforcesh/bullmq/commit/b7dd925e7f2a4468c98a05f3a3ca1a476482b6c0))
### [`v5.20.1`](https://redirect.github.com/taskforcesh/bullmq/releases/tag/v5.20.1)
[Compare Source](https://redirect.github.com/taskforcesh/bullmq/compare/v5.20.0...v5.20.1)
##### Bug Fixes
- **redis:** use version for naming loaded lua scripts ([fe73f6d](https://redirect.github.com/taskforcesh/bullmq/commit/fe73f6d4d776dc9f99ad3a094e5c59c5fafc96f1))
vitejs/vite (vite)
### [`v5.4.9`](https://redirect.github.com/vitejs/vite/releases/tag/v5.4.9)
[Compare Source](https://redirect.github.com/vitejs/vite/compare/v5.4.8...v5.4.9)
Please refer to [CHANGELOG.md](https://redirect.github.com/vitejs/vite/blob/v5.4.9/packages/vite/CHANGELOG.md) for details.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Never, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
2.2.8
->2.3.0
4.17.10
->4.17.12
20.16.11
->20.16.13
5.20.0
->5.21.1
5.4.8
->5.4.9
Release Notes
reduxjs/redux-toolkit (@reduxjs/toolkit)
### [`v2.3.0`](https://redirect.github.com/reduxjs/redux-toolkit/releases/tag/v2.3.0) [Compare Source](https://redirect.github.com/reduxjs/redux-toolkit/compare/v2.2.8...v2.3.0) This **feature release** adds a new RTK Query `upsertQueryEntries` util to batch-upsert cache entries more efficiently, passes through additional values for use in `prepareHeaders`, and exports additional TS types around query options and selectors. #### Changelog ##### `upsertQueryEntries` RTK Query already had an `upsertQueryData` thunk that would upsert a single cache entry. However, some users wanted to upsert *many* cache entries (potentially hundreds or thousands), and found that `upsertQueryData` had poor performance in those cases. This is because `upsertQueryData` runs the full async request handling sequence, including dispatching both `pending` and `fulfilled` actions, each of which run the main reducer and update store subscribers. That means there's `2N` store / UI updates per item, so upserting hundreds of items becomes extremely perf-intensive. RTK Query now includes an `api.util.upsertQueryEntries` action that is meant to handle the batched upsert use case more efficiently. It's a single synchronous action that accepts an array of many `{endpointName, arg, value}` entries to upsert. This results in a single store update, making this vastly better for performance vs many individual `upsertQueryData` calls. We see this as having two main use cases. The first is prefilling the cache with data retrieved from storage on app startup (and it's worth noting that `upsertQueryEntries` can accept entries for many different endpoints as part of the same array). The second is to act as a "pseudo-normalization" tool. [RTK Query is *not* a "normalized" cache](https://redux-toolkit.js.org/rtk-query/usage/cache-behavior#no-normalized-or-de-duplicated-cache). However, there are times when you may want to prefill other cache entries with the contents of another endpoint, such as taking the results of a `getPosts` list endpoint response and prefilling the individual `getPost(id)` endpoint cache entries, so that components that reference an individual item endpoint already have that data available. Currently, you can implement the "pseudo-normalization" approach by dispatching `upsertQueryEntries` in an endpoint lifecycle, like this: ```ts const api = createApi({ endpoints: (build) => ({ getPosts: build.querytaskforcesh/bullmq (bullmq)
### [`v5.21.1`](https://redirect.github.com/taskforcesh/bullmq/releases/tag/v5.21.1) [Compare Source](https://redirect.github.com/taskforcesh/bullmq/compare/v5.21.0...v5.21.1) ##### Bug Fixes - **scripts:** add missing wait in isJobInList ([9ef865c](https://redirect.github.com/taskforcesh/bullmq/commit/9ef865c7de6086cb3c906721fd046aeed1e0d27f)) ### [`v5.21.0`](https://redirect.github.com/taskforcesh/bullmq/releases/tag/v5.21.0) [Compare Source](https://redirect.github.com/taskforcesh/bullmq/compare/v5.20.1...v5.21.0) ##### Features - **queue:** add option to skip metas update ([b7dd925](https://redirect.github.com/taskforcesh/bullmq/commit/b7dd925e7f2a4468c98a05f3a3ca1a476482b6c0)) ### [`v5.20.1`](https://redirect.github.com/taskforcesh/bullmq/releases/tag/v5.20.1) [Compare Source](https://redirect.github.com/taskforcesh/bullmq/compare/v5.20.0...v5.20.1) ##### Bug Fixes - **redis:** use version for naming loaded lua scripts ([fe73f6d](https://redirect.github.com/taskforcesh/bullmq/commit/fe73f6d4d776dc9f99ad3a094e5c59c5fafc96f1))vitejs/vite (vite)
### [`v5.4.9`](https://redirect.github.com/vitejs/vite/releases/tag/v5.4.9) [Compare Source](https://redirect.github.com/vitejs/vite/compare/v5.4.8...v5.4.9) Please refer to [CHANGELOG.md](https://redirect.github.com/vitejs/vite/blob/v5.4.9/packages/vite/CHANGELOG.md) for details.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Never, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR was generated by Mend Renovate. View the repository job log.