| 354 | }); |
| 355 | }, |
| 356 | moveAfter(key: Key, keys: Iterable<Key>) { |
| 357 | dispatch(state => { |
| 358 | let toIndex = state.items.findIndex(item => getKey!(item) === key); |
| 359 | if (toIndex === -1) { |
| 360 | return state; |
| 361 | } |
| 362 | |
| 363 | let keyArray = Array.isArray(keys) ? keys : [...keys]; |
| 364 | let indices = keyArray |
| 365 | .map(key => state.items.findIndex(item => getKey!(item) === key)) |
| 366 | .sort((a, b) => a - b); |
| 367 | return move(state, indices, toIndex + 1); |
| 368 | }); |
| 369 | }, |
| 370 | update(key: Key, newValue: T | ((prev: T) => T)) { |
| 371 | dispatch(state => { |
| 372 | let index = state.items.findIndex(item => getKey!(item) === key); |