Skip to content

Feat/notify from outside#27

Open
petercrona wants to merge 7 commits into
masterfrom
feat/notify-from-outside
Open

Feat/notify from outside#27
petercrona wants to merge 7 commits into
masterfrom
feat/notify-from-outside

Conversation

@petercrona
Copy link
Copy Markdown
Member

@petercrona petercrona commented Apr 30, 2017

Adds notifier functions, functions that do not modify the cache, but can be used to trigger invalidation.

_notifyCreate
_notifyRead
_notifyUpdate
_notifyDelete

which will invalidate based on what is specified in an entity config. For eg. calling _notifyRead in { invalidates: ['user'], invalidatesOn: ['READ'], api: apiFns } would invalidate "user".

Usage: api.user._notifyCreate() // as if a normal create operation was called, but cache is untouched.

This allows the users to model their invalidation logic in Ladda and use it before they use Ladda for all API calls. A possible next step would be to allow the users to override the notify functions with their own implementations, that can also be configured on an API function level (eg. invalidate another api function). This might not be necessary though, since most of the time NO_OPERATION can be used for this.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.6%) to 98.638% when pulling 476fa94 on feat/notify-from-outside into 1f579db on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 98.938% when pulling 3c8b0c5 on feat/notify-from-outside into 1f579db on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 98.938% when pulling cda69c9 on feat/notify-from-outside into 1f579db on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 98.938% when pulling cda69c9 on feat/notify-from-outside into 1f579db on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.2%) to 99.388% when pulling 2b56bd1 on feat/notify-from-outside into 1f579db on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants