diff --git a/src/sidebar/helpers/build-thread.ts b/src/sidebar/helpers/build-thread.ts index ac80207d8db..9fcad56edb9 100644 --- a/src/sidebar/helpers/build-thread.ts +++ b/src/sidebar/helpers/build-thread.ts @@ -317,7 +317,13 @@ export function buildThread( }); } else if (options.threadFilterFn) { // Remove threads not matching thread-level filters - thread.children = thread.children.filter(options.threadFilterFn); + const threadFilterFn = options.threadFilterFn; + thread.children = thread.children.filter(thread => { + if (hasForcedVisible && options.forcedVisible.includes(thread.id)) { + return true; + } + return threadFilterFn(thread); + }); } // Set visibility for threads. diff --git a/src/sidebar/helpers/test/build-thread-test.js b/src/sidebar/helpers/test/build-thread-test.js index 87ed329eee3..3af76b91f67 100644 --- a/src/sidebar/helpers/test/build-thread-test.js +++ b/src/sidebar/helpers/test/build-thread-test.js @@ -475,11 +475,17 @@ describe('sidebar/helpers/build-thread', () => { text: 'note', target: [{ selector: undefined }], }, + { + id: '3', + text: 'annotation', + target: [{ selector: undefined }], + }, ]; - it('shows only annotations matching the thread filter', () => { + it('shows only annotations matching the thread filter and forced-visible threads', () => { const thread = createThread(fixture, { threadFilterFn: thread => metadata.isPageNote(thread.annotation), + forcedVisible: ['3'], }); assert.deepEqual(thread, [ @@ -487,6 +493,10 @@ describe('sidebar/helpers/build-thread', () => { annotation: fixture[1], children: [], }, + { + annotation: fixture[2], + children: [], + }, ]); }); });