Skip to content

Commit

Permalink
feat(explorer): add functions filter to query state (#3268)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <[email protected]>
  • Loading branch information
karooolis and holic authored Oct 8, 2024
1 parent 2c92401 commit 3d8db6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-sheep-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/explorer": patch
---

Function filters in `Interact` tab are now included as part of the URL.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"use client";

import { Coins, Eye, Send } from "lucide-react";
import { useQueryState } from "nuqs";
import { AbiFunction } from "viem";
import { useDeferredValue, useState } from "react";
import { useDeferredValue } from "react";
import { Input } from "../../../../../../components/ui/Input";
import { Separator } from "../../../../../../components/ui/Separator";
import { Skeleton } from "../../../../../../components/ui/Skeleton";
Expand All @@ -14,7 +15,7 @@ import { FunctionField } from "./FunctionField";
export function Form() {
const [hash] = useHashState();
const { data, isFetched } = useWorldAbiQuery();
const [filterValue, setFilterValue] = useState("");
const [filterValue, setFilterValue] = useQueryState("function", { defaultValue: "" });
const deferredFilterValue = useDeferredValue(filterValue);
const filteredFunctions = data?.abi?.filter(
(item) => item.type === "function" && item.name.toLowerCase().includes(deferredFilterValue.toLowerCase()),
Expand Down

0 comments on commit 3d8db6f

Please sign in to comment.