Changed input text to update when not changed nothing
This commit is contained in:
parent
1305077b3d
commit
62015744d2
1 changed files with 6 additions and 6 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { uniqueId } from "lodash";
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import PaginatorComponent from "../../components/PaginatorComponent";
|
import PaginatorComponent from "../../components/PaginatorComponent";
|
||||||
import ShadTooltip from "../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../components/ShadTooltipComponent";
|
||||||
|
|
@ -39,7 +40,7 @@ export default function StorePage(): JSX.Element {
|
||||||
const [pageOrder, setPageOrder] = useState("Popular");
|
const [pageOrder, setPageOrder] = useState("Popular");
|
||||||
const [tags, setTags] = useState<{ id: string; name: string }[]>([]);
|
const [tags, setTags] = useState<{ id: string; name: string }[]>([]);
|
||||||
const [tabActive, setTabActive] = useState("All");
|
const [tabActive, setTabActive] = useState("All");
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchNow, setSearchNow] = useState("");
|
||||||
const [selectFilter, setSelectFilter] = useState("all");
|
const [selectFilter, setSelectFilter] = useState("all");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -78,7 +79,7 @@ export default function StorePage(): JSX.Element {
|
||||||
validApiKey,
|
validApiKey,
|
||||||
hasApiKey,
|
hasApiKey,
|
||||||
apiKey,
|
apiKey,
|
||||||
searchText,
|
searchNow,
|
||||||
loadingApiKey,
|
loadingApiKey,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -102,7 +103,7 @@ export default function StorePage(): JSX.Element {
|
||||||
tags: filteredCategories,
|
tags: filteredCategories,
|
||||||
liked: selectFilter === "likedbyme" && validApiKey ? true : null,
|
liked: selectFilter === "likedbyme" && validApiKey ? true : null,
|
||||||
status: null,
|
status: null,
|
||||||
search: searchText === "" ? null : searchText,
|
search: inputText === "" ? null : inputText,
|
||||||
filterByUser: selectFilter === "createdbyme" && validApiKey ? true : null,
|
filterByUser: selectFilter === "createdbyme" && validApiKey ? true : null,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -191,9 +192,8 @@ export default function StorePage(): JSX.Element {
|
||||||
setInputText(e.target.value);
|
setInputText(e.target.value);
|
||||||
}}
|
}}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
console.log(e);
|
|
||||||
if (e.key === "Enter") {
|
if (e.key === "Enter") {
|
||||||
setSearchText(inputText);
|
setSearchNow(uniqueId());
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
value={inputText}
|
value={inputText}
|
||||||
|
|
@ -202,7 +202,7 @@ export default function StorePage(): JSX.Element {
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
className="absolute bottom-0 right-4 top-0 my-auto h-6 cursor-pointer stroke-1 text-muted-foreground"
|
className="absolute bottom-0 right-4 top-0 my-auto h-6 cursor-pointer stroke-1 text-muted-foreground"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSearchText(inputText);
|
setSearchNow(uniqueId());
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue