Skip to content

MintStore Input Fix (?) #450

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

Merged
merged 2 commits into from
May 25, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/components/form/CustomCopyrightForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
return null
} else if (key === 'expirationDateExists') {
return (
<>
<React.Fragment key={key}>
<li key={key}>
{clauseLabels[key]}: {descriptions[key][value]}
</li>
Expand All @@ -140,7 +140,7 @@
)
: 'None'}
</li>
</>
</React.Fragment>
)
} else if (key === 'addendum') {
return <li key={key}>Addendum: {value ? '✅ Yes' : '🚫 No'}</li>
Expand Down Expand Up @@ -318,7 +318,7 @@
}

return documentText
}, [address, clauseNumber, clauses, minterName])

Check warning on line 321 in src/components/form/CustomCopyrightForm.jsx

View workflow job for this annotation

GitHub Actions / build (18)

React Hook useCallback has a missing dependency: 'watch'. Either include it or remove the dependency array

// logic for checkboxes
const handleChange = useCallback((value, name) => {
Expand Down
8 changes: 0 additions & 8 deletions src/components/form/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ function Form({ fields, defaultValues, children, onSubmit, onReset }) {
formState: { errors },
} = useFormContext()

// Watch all form values and update mintStore
const formValues = watch()
useEffect(() => {
if (Object.keys(formValues).length > 0) {
useMintStore.setState(formValues)
}
}, [formValues])

return (
<form style={{ width: '100%' }} onSubmit={handleSubmit(onSubmit)}>
{fields.map((f) => {
Expand Down
7 changes: 4 additions & 3 deletions src/components/form/MintForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
isMonoType,
} = useOutletContext()
const navigate = useNavigate()
const { control } = useFormContext()
const { defaultValues } = useFormState({ control })
const [needsCover, setNeedsCover] = useState(false)
const [isTypedArt, setIsTypedArt] = useState(false)
const [preview, setPreview] = useState(null)

// Get the current state from the mint store
const mintStoreState = useMintStore((state) => state)

// Dynamically update conditional fields
const fields = useMemo(() => {
return mint_fields({
Expand Down Expand Up @@ -73,7 +74,7 @@
} else {
setPreview(undefined)
}
}, [isTypedArt, typedinput, isMonoType])

Check warning on line 77 in src/components/form/MintForm.jsx

View workflow job for this annotation

GitHub Actions / build (18)

React Hook useEffect has a missing dependency: 'generateCoverImagePreview'. Either include it or remove the dependency array

const generateCoverImagePreview = async (inputText) => {
try {
Expand Down Expand Up @@ -135,7 +136,7 @@
</div>
)}
<Form
defaultValues={defaultValues}
defaultValues={mintStoreState}
onSubmit={onSubmit}
onReset={useMintStore.getState().reset}
fields={fields}
Expand Down
2 changes: 0 additions & 2 deletions src/components/preview/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ export const Preview = () => {
st.isMonoType,
])

console.log('customLicenseData in Preview', customLicenseData)

const { ignoreUriMap } = useSettings()
const token_tags = tags
? tags === ''
Expand Down
Loading