From b436971a091d1512c3c3ebaf83e707d38dcfdf26 Mon Sep 17 00:00:00 2001 From: Octopus Date: Mon, 20 Apr 2026 03:04:45 +0800 Subject: [PATCH] fix: correct typo in cacheScores debug log and add JSDoc to filterDataByState (#5468) * fix: limit max-height of select[multiple] on mobile to prevent Chrome 145+ full-screen rendering (fixes #5242) * fix: correct typo in cacheScores debug log and add JSDoc to filterDataByState (fixes #5252) * fix: Correct jsdoc syntax --------- Co-authored-by: octo-patch Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> --- public/scripts/filters.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/scripts/filters.js b/public/scripts/filters.js index bd4888129..932f24756 100644 --- a/public/scripts/filters.js +++ b/public/scripts/filters.js @@ -289,6 +289,16 @@ export class FilterHelper { return this.filterDataByState(data, state, isFolder); } + /** + * Filters an array of entities based on a tri-state filter value. + * SELECTED keeps entities where filterFunc returns true; EXCLUDED removes them; UNDEFINED returns data unchanged. + * @param {any[]} data The data to filter + * @param {FilterState|string} state The tri-state filter value (SELECTED, EXCLUDED, or UNDEFINED) + * @param {Function} filterFunc A predicate function applied to each entity + * @param {object} [options] Options object + * @param {boolean} [options.includeFolders=false] If true, entities with type 'tag' always pass through + * @returns {any[]} The filtered data + */ filterDataByState(data, state, filterFunc, { includeFolders = false } = {}) { if (isFilterState(state, FILTER_STATES.SELECTED)) { return data.filter(entity => filterFunc(entity) || (includeFolders && entity.type == 'tag')); @@ -414,7 +424,7 @@ export class FilterHelper { typeScores.set(uid, score); } this.scoreCache.set(type, typeScores); - console.debug('search scores chached', type, typeScores); + console.debug('search scores cached', type, typeScores); } /**