@@ -9,7 +9,12 @@ import type {
99 createIndexes as createIndexesDecl ,
1010} from '../@types/indexes/index.d.ts' ;
1111import type { GetCell , Store } from '../@types/store/index.d.ts' ;
12- import { arrayIsSorted , arrayMap , arraySort } from '../common/array.ts' ;
12+ import {
13+ arrayForEach ,
14+ arrayIsSorted ,
15+ arrayMap ,
16+ arraySort ,
17+ } from '../common/array.ts' ;
1318import {
1419 collDel ,
1520 collForEach ,
@@ -99,7 +104,7 @@ export const createIndexes = getCreateFunction((store: Store): Indexes => {
99104 change : ( ) => void ,
100105 changedSliceIds : IdMap < [ Id | Ids | undefined , Id | Ids | undefined ] > ,
101106 changedSortKeys : IdMap < SortKey > ,
102- sliceIds ?: IdMap < Id | Ids > ,
107+ sliceIdOrIdsByRowId ?: IdMap < Id | Ids > ,
103108 sortKeys ?: IdMap < SortKey > ,
104109 force ?: boolean ,
105110 ) => {
@@ -150,8 +155,13 @@ export const createIndexes = getCreateFunction((store: Store): Indexes => {
150155 mapForEach ( index , ( sliceId ) => setAdd ( unsortedSlices , sliceId ) ) ;
151156 } else {
152157 mapForEach ( changedSortKeys , ( rowId ) =>
153- ifNotUndefined ( mapGet ( sliceIds , rowId ) , ( sliceId ) =>
154- setAdd ( unsortedSlices , sliceId ) ,
158+ ifNotUndefined (
159+ mapGet ( sliceIdOrIdsByRowId , rowId ) ,
160+ ( sliceIdOrIds ) =>
161+ arrayForEach (
162+ isArray ( sliceIdOrIds ) ? sliceIdOrIds : [ sliceIdOrIds ] ,
163+ ( sliceId ) => setAdd ( unsortedSlices , sliceId ) ,
164+ ) ,
155165 ) ,
156166 ) ;
157167 }
0 commit comments