Skip to content

Commit cd4bea1

Browse files
ryangtanaka-orgZir0h
authored andcommitted
fix: MintStore Input Fix (teia-community#450)
1 parent 998f100 commit cd4bea1

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

src/components/copyright/form/CustomCopyrightForm.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const ClausesDescriptions = ({ clauses }) => {
125125
return null
126126
} else if (key === 'expirationDateExists') {
127127
return (
128-
<>
128+
<React.Fragment key={key}>
129129
<li key={key}>
130130
{clauseLabels[key]}: {descriptions[key][value]}
131131
</li>
@@ -142,7 +142,7 @@ export const ClausesDescriptions = ({ clauses }) => {
142142
)
143143
: 'None'}
144144
</li>
145-
</>
145+
</React.Fragment>
146146
)
147147
} else if (key === 'addendum') {
148148
return <li key={key}>Addendum: {value ? '✅ Yes' : '🚫 No'}</li>

src/components/form/Form.jsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ function Form({ fields, defaultValues, children, onSubmit, onReset }) {
1515
formState: { errors },
1616
} = useFormContext()
1717

18-
// Watch all form values and update mintStore
19-
const formValues = watch()
20-
useEffect(() => {
21-
if (Object.keys(formValues).length > 0) {
22-
useMintStore.setState(formValues)
23-
}
24-
}, [formValues])
25-
2618
return (
2719
<form style={{ width: '100%' }} onSubmit={handleSubmit(onSubmit)}>
2820
{fields.map((f) => {

src/components/form/MintForm.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ export default function MintForm() {
3131
isMonoType,
3232
} = useOutletContext()
3333
const navigate = useNavigate()
34-
const { control } = useFormContext()
35-
const { defaultValues } = useFormState({ control })
3634
const [needsCover, setNeedsCover] = useState(false)
3735
const [isTypedArt, setIsTypedArt] = useState(false)
3836
const [preview, setPreview] = useState(null)
3937

38+
// Get the current state from the mint store
39+
const mintStoreState = useMintStore((state) => state)
40+
4041
// Dynamically update conditional fields
4142
const fields = useMemo(() => {
4243
return mint_fields({
@@ -135,7 +136,7 @@ export default function MintForm() {
135136
</div>
136137
)}
137138
<Form
138-
defaultValues={defaultValues}
139+
defaultValues={mintStoreState}
139140
onSubmit={onSubmit}
140141
onReset={useMintStore.getState().reset}
141142
fields={fields}

src/components/preview/index.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ export const Preview = () => {
6969
st.isMonoType,
7070
])
7171

72-
console.log('customLicenseData in Preview', customLicenseData)
73-
7472
const { ignoreUriMap } = useSettings()
7573
const token_tags = tags
7674
? tags === ''

0 commit comments

Comments
 (0)