feat: cache custom attributes in IDB

This commit is contained in:
Shivam Mishra
2026-05-27 12:45:30 +05:30
parent 5cb517612f
commit c929319045
7 changed files with 47 additions and 7 deletions
@@ -54,6 +54,17 @@ export const actions = {
commit(types.SET_CUSTOM_ATTRIBUTE_UI_FLAG, { isFetching: false });
}
},
revalidate: async ({ commit }, { newKey }) => {
try {
const isExistingKeyValid = await AttributeAPI.validateCacheKey(newKey);
if (!isExistingKeyValid) {
const response = await AttributeAPI.refetchAndCommit(newKey);
commit(types.SET_CUSTOM_ATTRIBUTE, response.data);
}
} catch (error) {
// Ignore error
}
},
create: async function createAttribute({ commit }, attributeObj) {
commit(types.SET_CUSTOM_ATTRIBUTE_UI_FLAG, { isCreating: true });
try {