@reduxjs/toolkit
Advanced tools
Comparing version 2.2.4 to 2.2.5
{ | ||
"name": "@reduxjs/toolkit", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"description": "The official, opinionated, batteries-included toolset for efficient Redux development", | ||
@@ -106,3 +106,3 @@ "author": "Mark Erikson <mark@isquaredsoftware.com>", | ||
"lint": "eslint src examples", | ||
"test": "vitest --run --typecheck", | ||
"test": "vitest --typecheck --run ", | ||
"test:watch": "vitest --watch", | ||
@@ -109,0 +109,0 @@ "type-tests": "yarn tsc -p tsconfig.test.json --noEmit", |
@@ -8,2 +8,3 @@ import type { EntityAdapter, EntityState } from '../models' | ||
nanoid, | ||
PayloadAction, | ||
} from '@reduxjs/toolkit' | ||
@@ -787,2 +788,26 @@ import type { BookModel } from './fixtures/book' | ||
it('should not throw an Immer `current` error when `state.ids` is a plain array', () => { | ||
const book1: BookModel = { id: 'a', title: 'First' } | ||
const initialState = adapter.getInitialState() | ||
const withItems = adapter.addMany(initialState, [book1]) | ||
const booksSlice = createSlice({ | ||
name: 'books', | ||
initialState, | ||
reducers: { | ||
testCurrentBehavior(state, action: PayloadAction<BookModel>) { | ||
// Will overwrite `state.ids` with a plain array | ||
adapter.removeAll(state) | ||
// will call `splitAddedUpdatedEntities` and call `current(state.ids)` | ||
adapter.upsertMany(state, [book1]) | ||
}, | ||
}, | ||
}) | ||
booksSlice.reducer( | ||
initialState, | ||
booksSlice.actions.testCurrentBehavior(book1), | ||
) | ||
}) | ||
describe('can be used mutably when wrapped in createNextState', () => { | ||
@@ -789,0 +814,0 @@ test('removeAll', () => { |
@@ -50,3 +50,3 @@ import { current, isDraft } from 'immer' | ||
const existingIdsArray = current(state.ids) as Id[] | ||
const existingIdsArray = getCurrent(state.ids) as Id[] | ||
const existingIds = new Set<Id>(existingIdsArray) | ||
@@ -53,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5528401
64077