Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Fixed filter-search result retention bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aosasona committed Feb 25, 2023
1 parent 1e39bb0 commit dc2fea2
Show file tree
Hide file tree
Showing 2 changed files with 252 additions and 245 deletions.
9 changes: 8 additions & 1 deletion ui/src/components/Display.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fragment, useState } from "react";
import { Fragment, useEffect, useState } from "react";
import type { Process } from "../lib/types";
import { BsFilter } from "react-icons/bs/index";
import Loading from "./Loading";
Expand All @@ -16,6 +16,13 @@ export default function Display({ loading, processes, PIDs, setPIDs }: Props) {
);
const [filterQuery, setFilterQuery] = useState("");

useEffect(() => {
if (processes != null) {
setFilteredProcesses(null);
setFilterQuery("");
}
}, [processes]);

const toggleRowSelect = (pid: number) => {
if (PIDs.includes(pid)) {
const newPIDS = PIDs.filter((p) => p != pid);
Expand Down

0 comments on commit dc2fea2

Please sign in to comment.