Skip to content

Commit

Permalink
Merge pull request #238 from skip-mev/fix/route-not-refetching-when-s…
Browse files Browse the repository at this point in the history
…wap-details-opened

fix: route not refetching when swap details opened
  • Loading branch information
codingki authored Apr 4, 2024
2 parents 948e446 + f3c1668 commit a9d25b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/components/SwapWidget/SwapDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ChevronDownIcon, PencilSquareIcon } from "@heroicons/react/16/solid";
import * as Collapsible from "@radix-ui/react-collapsible";
import { BridgeType, RouteResponse } from "@skip-router/core";
import { useMemo } from "react";
import { useMemo, useState } from "react";

import { disclosure, useDisclosureKey } from "@/context/disclosures";
import { disclosure } from "@/context/disclosures";
import { useSettingsStore } from "@/context/settings";
import { formatPercent, formatUSD } from "@/utils/intl";
import { cn } from "@/utils/ui";
Expand Down Expand Up @@ -36,7 +36,7 @@ export const SwapDetails = ({
sourceChain,
sourceFeeAsset,
}: Props) => {
const [open, control] = useDisclosureKey("swapDetailsCollapsible");
const [detailsOpen, setDetailsOpen] = useState(false);

const { slippage } = useSettingsStore();

Expand Down Expand Up @@ -108,8 +108,8 @@ export const SwapDetails = ({
"hover:border-neutral-300 hover:shadow-sm",
"focus-within:border-neutral-300 focus-within:shadow-sm",
)}
open={open || priceImpactThresholdReached}
onOpenChange={control.set}
open={detailsOpen || priceImpactThresholdReached}
onOpenChange={(open) => setDetailsOpen(open)}
>
<div className="relative flex items-center gap-1 text-center text-xs">
<ConversionRate
Expand Down Expand Up @@ -153,12 +153,12 @@ export const SwapDetails = ({
<span
className={cn(
"animate-slide-left-and-fade tabular-nums text-neutral-400 transition-opacity",
open && "hidden",
detailsOpen && "hidden",
)}
>
Slippage: {slippage}%
</span>
<ChevronDownIcon className={cn("h-4 w-4 transition", open ? "rotate-180" : "rotate-0")} />
<ChevronDownIcon className={cn("h-4 w-4 transition", detailsOpen ? "rotate-180" : "rotate-0")} />
</Collapsible.Trigger>
</div>

Expand Down
1 change: 0 additions & 1 deletion src/context/disclosures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const defaultValues = {
historyDialog: false,
priceImpactDialog: false,
settingsDialog: false,
swapDetailsCollapsible: false,

// TODO: port dialogs to new system
// assetSelect: false,
Expand Down

0 comments on commit a9d25b7

Please sign in to comment.