Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/web/src/lib/__tests__/transcript-search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ describe('filterSegments — empty/null query behavior (#908)', () => {
segments.length,
);
});

it('returns the original segment array when no filters are active', () => {
expect(filterSegments(segments, { search: '' })).toBe(segments);
});
});

describe('filterSegments — null-safe segment text (#908)', () => {
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/lib/transcript-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export function filterSegments(
segments: readonly TranscriptSegment[],
{ search, speaker }: TranscriptFilter,
): TranscriptSegment[] {
if (!search && !speaker) return segments as TranscriptSegment[];

// Hoisted out of the loop: removes N toLowerCase() allocations per keystroke
// update on long transcripts. This is the optimization PR #972 shipped.
const lowerSearchQuery = search ? search.toLowerCase() : '';
Expand Down