refactor: fold cache revalidation into the event dispatcher
This commit is contained in:
@@ -4,39 +4,18 @@
|
||||
// so the server's `cache_keys` payload (and the IDB object store name) lines up
|
||||
// with what the client looks up.
|
||||
//
|
||||
// `dispatchPath` is the full Vuex dispatch path for the revalidate action.
|
||||
// `setMutation` is the full commit path used by paintStoresFromCache to seed
|
||||
// Vuex from IDB. Every SET_* mutation must REPLACE its records (not merge) so
|
||||
// rows deleted server-side never survive as phantoms.
|
||||
// `setMutation` is the full commit path used to seed Vuex from IDB (boot
|
||||
// paint) and to swap in refetched rows (event-driven revalidation). Every
|
||||
// SET_* mutation must REPLACE its records (not merge) so rows deleted
|
||||
// server-side never survive as phantoms.
|
||||
export const cacheableModels = [
|
||||
{
|
||||
name: 'inbox',
|
||||
dispatchPath: 'inboxes/revalidate',
|
||||
setMutation: 'inboxes/SET_INBOXES',
|
||||
},
|
||||
{
|
||||
name: 'label',
|
||||
dispatchPath: 'labels/revalidate',
|
||||
setMutation: 'labels/SET_LABELS',
|
||||
},
|
||||
{
|
||||
name: 'team',
|
||||
dispatchPath: 'teams/revalidate',
|
||||
setMutation: 'teams/SET_TEAMS',
|
||||
},
|
||||
{
|
||||
name: 'canned_response',
|
||||
dispatchPath: 'revalidateCannedResponses',
|
||||
setMutation: 'SET_CANNED',
|
||||
},
|
||||
{
|
||||
name: 'account_user',
|
||||
dispatchPath: 'agents/revalidate',
|
||||
setMutation: 'agents/SET_AGENTS',
|
||||
},
|
||||
{ name: 'inbox', setMutation: 'inboxes/SET_INBOXES' },
|
||||
{ name: 'label', setMutation: 'labels/SET_LABELS' },
|
||||
{ name: 'team', setMutation: 'teams/SET_TEAMS' },
|
||||
{ name: 'canned_response', setMutation: 'SET_CANNED' },
|
||||
{ name: 'account_user', setMutation: 'agents/SET_AGENTS' },
|
||||
{
|
||||
name: 'custom_attribute_definition',
|
||||
dispatchPath: 'attributes/revalidate',
|
||||
setMutation: 'attributes/SET_CUSTOM_ATTRIBUTE',
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user