Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/notify from outside #27

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

petercrona
Copy link
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

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

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