ActivityActions.reloadData does not trigger dataprovider

Hello,

I have a dataprovider for an activity which gets triggered by the load operation when I create the activity. At some point, I need to reload the data in the activity from its original source to overwrite-reset changes that have been made in between inside the dataholder of the activity.

For this I was assuming that I can simply dispatch an

dispatch(ActivityActions.reloadData({ activityId: props.activityId, }))

When inspecting with Redux DEV Tools, the action is dispatched correctly, but the
canHandle function in my DataProvider is never called thus the dataProvider never gets triggered and the data is never reloaded from the original source. The state of the activity remains as is.

I also tried ActivityActions.loadData, the result here is the same with the difference that that action changes the loading and busy state in the activity without anything happening further…
image

What am I missing here?
(I am not using any engines here, just Activities)

The list of DataProviders uses a first-come-first-serve principle. I assume that there is a DataProvider in your list that returns true before your DataProvider is ask.

That was also my first assumptions. But currently this is the only dataprovider in my application. So the only dataproviders which may return true and take my action could be a12 internal - hard to find out…

The problem was that the data provider forked a long-running child saga during the load operation.
Since A12 client waits for the data provider load operation to have completely finished, the DataHolderTracker-Cleanup was never performed. Thus, to the subsequent load call, it looked as if the data holder was already being handled.

Note: The long running saga can be as innocent-looking as takeEvery(...)…

Solution:
Either:

  • use spawn instead of fork if you must start a long running saga in your data holder, or
  • better: move the trigger for the long running saga out of the data provider and into another place.