1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-05-31 01:32:18 +00:00

Update filter caching to take into account the default filter run prefix

This commit is contained in:
Jeremy Ruston
2026-01-20 12:01:12 +00:00
parent f3e9beb1e1
commit beb6839a35
+4 -3
View File
@@ -249,12 +249,13 @@ options: optional hashmap of options
*/
exports.compileFilter = function(filterString,options) {
var defaultFilterRunPrefix = options?.defaultFilterRunPrefix || "or";
var cacheKey = filterString + '|' + defaultFilterRunPrefix;
if(!this.filterCache) {
this.filterCache = Object.create(null);
this.filterCacheCount = 0;
}
if(this.filterCache[filterString] !== undefined) {
return this.filterCache[filterString];
if(this.filterCache[cacheKey] !== undefined) {
return this.filterCache[cacheKey];
}
var filterParseTree;
try {
@@ -415,7 +416,7 @@ exports.compileFilter = function(filterString,options) {
this.filterCache = Object.create(null);
this.filterCacheCount = 0;
}
this.filterCache[filterString] = fnMeasured;
this.filterCache[cacheKey] = fnMeasured;
this.filterCacheCount++;
return fnMeasured;
};