Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/domain/market/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ export type ExchangeScope = "all" | "perp" | "spot" | "builders-perp";

export const EXCHANGE_SCOPES: ExchangeScope[] = ["all", "perp", "spot", "builders-perp"];

const isTestnet = typeof import.meta !== "undefined" && import.meta.env?.VITE_HYPERLIQUID_TESTNET === "true";

export const DEFAULT_SELECTED_MARKETS: Record<ExchangeScope, string> = {
all: "VOLX-USDH",
all: isTestnet ? "VOLX-USDH" : "CL-USDC",
perp: "BTC",
spot: "@107", // ETH/USDC
"builders-perp": "xyz:SILVER",
Expand Down
3 changes: 2 additions & 1 deletion src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createFileRoute } from "@tanstack/react-router";
import { useEffect } from "react";
import { TradeTerminalPage } from "@/components/trade/trade-terminal-page";
import { DEFAULT_SELECTED_MARKETS } from "@/domain/market";
import { buildPageHead } from "@/lib/seo";
import { useMarketActions } from "@/stores/use-market-store";

Expand All @@ -21,7 +22,7 @@ function IndexPage() {
const { setSelectedMarket } = useMarketActions();

useEffect(() => {
setSelectedMarket("all", "VOLX-USDH");
setSelectedMarket("all", DEFAULT_SELECTED_MARKETS.all);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This useEffect hook overrides the persisted market selection with the default value every time the user navigates to the home page. Since the marketStore already initializes with DEFAULT_SELECTED_MARKETS and handles persistence (as seen in use-market-store.ts), this call is likely redundant and potentially disruptive to the user experience as it clears their last selected market. Consider removing this useEffect block and the associated setSelectedMarket call to respect the persisted state.

}, [setSelectedMarket]);

return <TradeTerminalPage />;
Expand Down
Loading