Skip to content

Instantly share code, notes, and snippets.

@mikeapr4
Last active March 10, 2019 09:48
Show Gist options
  • Save mikeapr4/fe165b40e21ba3e4b3fee0d5e6f4b92b to your computer and use it in GitHub Desktop.
Save mikeapr4/fe165b40e21ba3e4b3fee0d5e6f4b92b to your computer and use it in GitHub Desktop.
an example rudimentary vuex method-style getter cache - don't use this, just for illustration
mappedTask2: (state, getters) => {
const cache = {};
return (id) => {
const record = state.tasks[id];
const key = id + record.name;
if (!cache[key]) {
cache[key] = getters.mappedTask(id);
}
return cache[key];
};
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment