Skip to content

Commit

Permalink
Fix a bug in 'search in logs'
Browse files Browse the repository at this point in the history
  • Loading branch information
hulxv committed Jan 5, 2022
1 parent 2a5ebc7 commit b81f570
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions renderer/components/Settings/Logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import {
} from "react-icons/hi";
import { useLogs } from "../../context/logs";

const NUMBER_OF_MESSAGES = 100;

function Logs() {
const { logs, GetLogs, ClearLogs, isLoading } = useLogs();

Expand All @@ -54,9 +56,8 @@ function Logs() {
setLogsAfterFiltering(
logs?.lines.filter(
(line) =>
(line.content.toLowerCase().includes(search.value.toLowerCase()) &&
line.status === StatusFilter) ||
StatusFilter === "all",
line.content.toLowerCase().includes(search.value.toLowerCase()) &&
(line.status === StatusFilter || StatusFilter === "all"),
),
);
}, [search.value, logs]);
Expand Down Expand Up @@ -161,7 +162,11 @@ function Logs() {
No logs found
</Heading>
) : (
<LogRows data={LogsAfterFiltering} />
<LogRows
data={LogsAfterFiltering.slice(
Math.max(LogsAfterFiltering.length - NUMBER_OF_MESSAGES, 0),
)}
/>
)}
</Stack>
</>
Expand Down

0 comments on commit b81f570

Please sign in to comment.