Skip to content

Commit

Permalink
refactor(demo-app): disable RFQ query when any quote tracking is in p…
Browse files Browse the repository at this point in the history
…rocess
  • Loading branch information
pavel-rakhmanov committed Dec 4, 2024
1 parent 25e7ebc commit b2ffcab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/next-js-app/hooks/useRfq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import {
import { useDebounce } from "@/hooks";
import { floatToBigNumber } from "@/lib/utils";
import { useSwapForm } from "@/providers/swap-form";
import { useTrackingQuoteState } from "@/providers/tracking-quote";

export const useRfq = () => {
const { askAsset, offerAsset, askAmount, offerAmount } = useSwapForm();
const { quoteId } = useTrackingQuoteState();

const [debouncedQuoteRequest] = useDebounce<QuoteRequest>(
{
Expand All @@ -35,6 +37,6 @@ export const useRfq = () => {
debouncedQuoteRequest.amount?.offerUnits !== undefined;

return _useRfq(debouncedQuoteRequest, {
enabled: isFormFilled,
enabled: isFormFilled && !quoteId,
});
};

0 comments on commit b2ffcab

Please sign in to comment.