Skip to content

Commit

Permalink
Merge pull request #43 from Quantum3-Labs/31-button-call
Browse files Browse the repository at this point in the history
Read method called on 1st render
  • Loading branch information
jrcarlos2000 authored Apr 13, 2024
2 parents b8dc760 + 8bfa215 commit fbcef8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client";

import { useState } from "react";
import { InheritanceTooltip } from "./InheritanceTooltip";
import { Abi } from "abi-wan-kanabi";
import { Address } from "@starknet-react/chains";
import {
Expand All @@ -12,7 +11,6 @@ import {
getParsedContractFunctionArgs,
transformAbiFunction,
} from "~~/app/debug/_components/contract";
import { notification } from "~~/utils/scaffold-stark";
import { AbiFunction } from "~~/utils/scaffold-stark/contract";
import { BlockNumber } from "starknet";
import { useContractRead } from "@starknet-react/core";
Expand All @@ -36,7 +34,7 @@ export const ReadOnlyFunctionForm = ({
);
const [result, setResult] = useState<unknown>();

const { isFetching, refetch } = useContractRead({
const { isLoading, isFetching, refetch } = useContractRead({
address: contractAddress,
functionName: abiFunction.name,
abi: [...abi],
Expand Down Expand Up @@ -85,9 +83,9 @@ export const ReadOnlyFunctionForm = ({
const { data } = await refetch();
setResult(data);
}}
disabled={isFetching}
disabled={!isLoading && isFetching}
>
{isFetching && (
{!isLoading && isFetching && (
<span className="loading loading-spinner loading-xs"></span>
)}
Read 📡
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/scaffold.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type ScaffoldConfig = {
};

const scaffoldConfig = {
targetNetworks: [chains.devnet],
targetNetworks: [chains.sepolia],
// Only show the Burner Wallet when running on devnet
onlyLocalBurnerWallet: false,
rpcProviderUrl: process.env.NEXT_PUBLIC_PROVIDER_URL || "",
Expand Down

0 comments on commit fbcef8f

Please sign in to comment.