Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
fix: leading zeroes in search bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiago Pittella authored and Santiago Pittella committed Nov 29, 2023
1 parent 58bdee2 commit 68fe4a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/starknet_explorer_web/live/contract_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ defmodule StarknetExplorerWeb.ContractDetailLive do
[contract.address]
)

Process.send_after(self(), :fetch_portfolio, 100)

[
contract: contract,
view: "overview",
Expand All @@ -146,8 +148,6 @@ defmodule StarknetExplorerWeb.ContractDetailLive do
]
end

Process.send_after(self(), :fetch_portfolio, 100)

{:ok,
put_flash(
assign(socket, assigns),
Expand Down
10 changes: 5 additions & 5 deletions lib/starknet_explorer_web/live/search.ex
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ defmodule StarknetExplorerWeb.SearchLive do
result_item: query,
result: "Contract",
loading: false,
path: "contracts/#{query}"
path: "contracts/#{query |> StarknetExplorer.Utils.trim_leading_zeroes()}"
)
end

Expand All @@ -246,7 +246,7 @@ defmodule StarknetExplorerWeb.SearchLive do
result_item: query,
result: "Class",
loading: false,
path: "classes/#{query}"
path: "classes/#{query |> StarknetExplorer.Utils.trim_leading_zeroes()}"
)
end

Expand All @@ -256,7 +256,7 @@ defmodule StarknetExplorerWeb.SearchLive do
result_item: query,
result: "Transaction",
loading: false,
path: "transactions/#{query}"
path: "transactions/#{query |> StarknetExplorer.Utils.trim_leading_zeroes()}"
)
end

Expand All @@ -266,7 +266,7 @@ defmodule StarknetExplorerWeb.SearchLive do
result_item: block,
result: "Block",
loading: false,
path: "blocks/#{get_hash(block)}"
path: "blocks/#{get_hash(block |> StarknetExplorer.Utils.trim_leading_zeroes())}"
)
end

Expand Down Expand Up @@ -306,7 +306,7 @@ defmodule StarknetExplorerWeb.SearchLive do

defp try_search(query, network) do
case infer_query(query) do
:hex -> try_by_hash(query, network)
:hex -> try_by_hash(query |> StarknetExplorer.Utils.trim_leading_zeroes(), network)
{:number, number} -> try_by_number(number, network)
:uuid -> try_by_uuid(query, network)
:noquery -> :noquery
Expand Down

0 comments on commit 68fe4a5

Please sign in to comment.