import { defineModel } from '../../src' ; const initialState = { users : { } , ids : [ ] , } ; export const complexModel = defineModel ( 'complex' , { initialState , actions : { addUser ( state , id , name ) { state . users [ id ] = name ; ! state . ids . includes ( id ) && state . ids . push ( id ) ; } , deleteUser ( state , id ) { delete state . users [ id ] ; state . ids = state . ids . filter ( ( item ) => item !== id ) ; } , updateUser ( state , id , name ) { state . users [ id ] = name ; } , } , } ) ;