Improve sync / refresh of resources
Description
Environment
Potential Workaround
relates to
Checklist
hideTestRail: Results
Activity

Michal Kuklis September 24, 2018 at 2:54 PMEdited
The current implementation (path matching) is limited and it fails for couple reasons:
When the path is dynamic the match will never happen. This is the case with the tags resource and the link path: https://github.com/folio-org/stripes-smart-components/blob/master/lib/Tags/Tags.js#L23
We want to refresh unrelated resources. I believe this is what happens now with the anonymize endpoint in https://folio-org.atlassian.net/browse/UIU-647 but I'm sure we will run into other cases.
I would like to propose a new function which could be specified right on the manifest called shouldRefresh (or perhaps shouldResourceRefresh). If the function is present it would be executed instead of path matching:
https://github.com/folio-org/stripes-connect/blob/master/epics/refresh.js#L9
This would give us more control over when a given resource should be refreshed or not.
We use side effects for syncing / refreshing resources. This is currently done based on the matching paths (template paths) between resources:
https://github.com/folio-org/stripes-connect/blob/master/epics/refresh.js#L9
Unfortunately this is not good enough for some of the cases we are running into.
One of them is https://folio-org.atlassian.net/browse/UIU-647#icft=UIU-647 which is related to https://folio-org.atlassian.net/browse/UIU-463#icft=UIU-463. Another one is https://folio-org.atlassian.net/browse/FOLIO-1506#icft=FOLIO-1506.
I would like to introduce another param which can be specified in the manifest to indicate when a given resource should be refreshed.