Skip to content

Commit 22c1473

Browse files
authored
fix: fixes search skipping every other log (#3180)
1 parent f53c4d7 commit 22c1473

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

assets/composable/search.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function matchRecord(record: Record<string, any>, regex: RegExp): boolean {
2525
export function useSearchFilter() {
2626
const regex = $computed(() => {
2727
const isSmartCase = debouncedSearchFilter.value === debouncedSearchFilter.value.toLowerCase();
28-
return new RegExp(encodeXML(debouncedSearchFilter.value), isSmartCase ? "ig" : "g");
28+
return new RegExp(encodeXML(debouncedSearchFilter.value), isSmartCase ? "i" : "");
2929
});
3030

3131
function filteredMessages(messages: Ref<LogEntry<string | JSONObject>[]>) {
@@ -63,7 +63,8 @@ export function useSearchFilter() {
6363
return log.map((d) => markSearch(d));
6464
}
6565

66-
return log.toString().replace(regex, (match) => `<mark>${match}</mark>`);
66+
const globalRegex = new RegExp(regex.source, regex.flags + "g");
67+
return log.toString().replaceAll(globalRegex, (match) => `<mark>${match}</mark>`);
6768
}
6869

6970
function resetSearch() {

0 commit comments

Comments
 (0)