Improve sync / refresh of resources

Description

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.

Environment

None

Potential Workaround

None

Checklist

hide

TestRail: Results

Activity

Show:

Michal Kuklis September 24, 2018 at 2:54 PM
Edited

The current implementation (path matching) is limited and it fails for couple reasons:

  1. 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

  2. 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.

Done

Details

Assignee

Reporter

Labels

Priority

Fix versions

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created September 20, 2018 at 2:34 PM
Updated September 25, 2018 at 2:20 PM
Resolved September 25, 2018 at 2:20 PM
TestRail: Cases
TestRail: Runs