1- import React , { useMemo , useState } from "react" ;
1+ import React , { useMemo } from "react" ;
22import styled , { css } from "styled-components" ;
33
44import { AlertMessage , Checkbox , DropdownCascader , DropdownSelect , Field } from "@kleros/ui-components-library" ;
@@ -88,7 +88,6 @@ const StyledCheckbox = styled(Checkbox)`
8888
8989const Court : React . FC = ( ) => {
9090 const { disputeData, setDisputeData } = useNewDisputeContext ( ) ;
91- const [ isGatedDisputeKit , setIsGatedDisputeKit ] = useState ( false ) ;
9291 const { data : courtTree } = useCourtTree ( ) ;
9392 const { data : supportedDisputeKits } = useSupportedDisputeKits ( disputeData . courtId ) ;
9493 const items = useMemo ( ( ) => ! isUndefined ( courtTree ?. court ) && [ rootCourtToItems ( courtTree . court ) ] , [ courtTree ] ) ;
@@ -123,7 +122,7 @@ const Court: React.FC = () => {
123122 } ;
124123
125124 const handleDisputeKitChange = ( newValue : string | number ) => {
126- const options = disputeKitOptions . find ( ( dk ) => dk . value === String ( newValue ) ) ;
125+ const options = disputeKitOptions . find ( ( dk ) => String ( dk . value ) === String ( newValue ) ) ;
127126 const isNewValueGated = options ?. gated ?? false ;
128127 const gatedDisputeKitData : IGatedDisputeData | undefined = isNewValueGated
129128 ? {
@@ -133,10 +132,14 @@ const Court: React.FC = () => {
133132 tokenId : "0" ,
134133 }
135134 : undefined ;
136- setIsGatedDisputeKit ( isNewValueGated ) ;
137135 setDisputeData ( { ...disputeData , disputeKitId : Number ( newValue ) , disputeKitData : gatedDisputeKitData } ) ;
138136 } ;
139137
138+ const isGatedDisputeKit = useMemo ( ( ) => {
139+ const options = disputeKitOptions . find ( ( dk ) => String ( dk . value ) === String ( selectedDisputeKitId ) ) ;
140+ return options ?. gated ?? false ;
141+ } , [ disputeKitOptions , selectedDisputeKitId ] ) ;
142+
140143 const handleTokenAddressChange = ( event : React . ChangeEvent < HTMLInputElement > ) => {
141144 const currentData = disputeData . disputeKitData as IGatedDisputeData ;
142145 setDisputeData ( {
0 commit comments