More robust handling of prompt tag filtering

This commit is contained in:
Gregory Schier committed 2019-05-07 14:08:57 -04:00
1 parent b2ebeeea70
commit 6b3dee759d
1 file changed
+7 -1
+7 -1
View File
@@ -4,7 +4,13 @@ module.exports.responseHooks = [
async context => {
const items = await context.store.all();
const requestId = context.request.getId();
const toRemove = items.filter(v => v.key.indexOf(requestId) === 0);
const toRemove = items.filter(v => {
if (v.key && typeof v.key === 'string') {
return v.key.indexOf(requestId) === 0;
}
return false;
});
// Delete cached values we prompt again on the next request
for (const { key } of toRemove) {
await context.store.removeItem(key);