I would like to do something after my form finishes on saving something. Does A12 fire any event or action after the form-engine finishes saving data, which I can hook to it? Currently, I only know that the saving state will change to DONE. I tried this code but it seems doesn’t work:
yield take(ActivityActions.save.done.type)
Hi :),
dependent on the action you want to listen to ActivityActions.save.done or ActivityActions.commit.done should solve this.
Did you check if the done action is triggered at all? Maybe if you have a custom provider you did not dispatch the actionCreator.saving.done({})) action.
You did not use a generator yield i can see in your example, how is it when you try this code example:
yield* take(action => ActivityActions.save.done.match(action));
Actually the action is not triggered at all as we have a custom provider. Can you show me how we dispatch this action? I’ve tried
yield put(ActivityActions.commit.done)
or
yield put(ActivityActions.save.done)
But I always receive COMMIT_FAILED action in redux store.
I’ve tried a generator yield but it has compile error.
Sorry for that actionCreator in here is an project specific prop name.
From original type it is the details prop of data providers argument type ProvideDataConfig → SaveConfig.
See type definition: node_modules/@com.mgmtp.a12.client/client-core/src/core/data/internal/DataProvider.ts
Then you have to do from inside your custom data provider save case:
yield put(details.saving.done( { //any result payload should go in here } ))
or in error case
yield put(details.saving.failed( { // any error should go in here } ))
Many thanks. It solved my problem.