Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: infinite loop dep, wrong fallback validation #172

Merged
merged 3 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 4 additions & 3 deletions src/lib/components/modal/contract/ContractDetailsTemplate.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
import { Flex, Text } from "@chakra-ui/react";
import { useCallback, useEffect, useMemo } from "react";
import { useForm } from "react-hook-form";
Expand Down Expand Up @@ -34,10 +35,10 @@ export const ContractDetailsTemplateModal = ({
};
}, [
contractLocalInfo.description,
contractLocalInfo.lists,
JSON.stringify(contractLocalInfo.lists),
contractLocalInfo.name,
contractLocalInfo.tags,
defaultList,
JSON.stringify(defaultList),
]);

const {
Expand All @@ -58,7 +59,7 @@ export const ContractDetailsTemplateModal = ({

useEffect(() => {
resetForm();
}, [defaultValues, resetForm]);
}, [resetForm]);

const offchainState = watch();

Expand Down
3 changes: 2 additions & 1 deletion src/lib/model/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const useCodeContractInstances = (
codeId: number,
offset: number,
pageSize: number
): Option<ContractInstances> => {
): ContractInstances => {
const { data: contractList } = useContractListByCodeId(
codeId,
offset,
Expand All @@ -47,6 +47,7 @@ export const useCodeContractInstances = (
...contract,
} as ContractLocalInfo;
});

return {
contractList: data,
count,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/contract-details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ContractDetailsBody = observer(
refetchRelatedProposals,
} = useContractDetailsTableCounts(contractAddress);

if (!contractData) return <InvalidContract />;
if (!contractData?.instantiateInfo) return <InvalidContract />;

return (
<>
Expand Down