Home
Using Smart NgRX
Demo Walkthrough
API
@smarttools/smart-ngrx / Interface

ActionGroup

Generic types:T

Interface that describes a group of actions for a feature

Properties

NameTypeDescription
add
ActionCreator<`[${any}] Add`, (props: { row: T; feature: string; entity: string; parentId: string; parentFeature: string; parentEntityName: string; }) => Action<`[${any}] Add`> & { row: T; feature: string; entity: string; parentId: string; parentFeature: string; parentEntityName: string; }>

Action to trigger adding a new row

addSuccess
ActionCreator<`[${any}] Add Success`, (props: { oldRow: T; newRow: T; feature: string; entity: string; parentId: string; parentFeature: string; parentEntityName: string; }) => Action<`[${any}] Add Success`> & { oldRow: T; newRow: T; feature: string; entity: string; parentId: string; parentFeature: string; parentEntityName: string; }>

Action to trigger storing a new row

delete
ActionCreator<`[${any}] Delete`, (props: { id: string; parentInfo: { feature: string; entity: string; ids: string[]; }[]; }) => Action<`[${any}] Delete`> & { id: string; parentInfo: { feature: string; entity: string; ids: string[]; }[]; }>

Action to trigger deleting a new row, this eventually calls the effect service which will handle the physical delete on the server.

loadByIds
ActionCreator<`[${any}] Load By Ids`, (props: IdsProp) => Action<`[${any}] Load By Ids`> & IdsProp>

Action to load rows by their IDs.

loadByIndexes
ActionCreator<`[${any}] Load By Indexes`, (props: IndexesProp) => Action<`[${any}] Load By Indexes`> & IndexesProp>

Action to load rows by their index.

remove
ActionCreator<`[${any}] Remove`, (props: IdsProp) => Action<`[${any}] Remove`> & IdsProp>

Action to remove rows represented by the IDs from the store.

storeRows
ActionCreator<`[${any}] Store Rows`, (props: RowsProp<T>) => Action<`[${any}] Store Rows`> & RowsProp<T>>

Action to put rows into the store.

update
ActionCreator<`[${any}] Update`, (props: { old: RowProp<T>; new: RowProp<T>; }) => Action<`[${any}] Update`> & { old: RowProp<T>; new: RowProp<T>; }>

Action to update a row in the store. The old row is passed so we can roll back on failure.

updateMany
ActionCreator<`[${any}] Update Many`, (props: UpdateChanges<T>) => Action<`[${any}] Update Many`> & UpdateChanges<T>>

Action to update state with multiple changes at a time.