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

updateEffect

Generic types:T

this handles the update by calling the effectService.update() method. Any errors and retries should be handled by the service including reverting the optimistic update the service will return the latest rows that should be sent to the store.

To support multiple calls to the effect in sequence, we handle debounces here but we use a long debounce time of 2 seconds. Since we are using optimistic updates, the changes will be seen locally immediately and the user will not be blocked by the debounce.

Presentation

function updateEffect(
  effectServiceToken: InjectionToken<EffectService<T>>,
  actions: ActionGroup<T>,
  feature: string,
  entity: string,
): (
  actions$?: Actions<any>,
  effectService?: EffectService<T>,
) => Observable<void>;

Returns

(actions$?: Actions<any>, effectService?: EffectService<T>) => Observable<void> -

the update effect

Parameters

NameTypeDescription
effectServiceToken
InjectionToken<EffectService<T>>

the token for the effectService that will be called

actions
ActionGroup<T>

the action group for the source provided

feature
string

the name of the feature this is for

entity
string

the name of the entity this is for