fixed default template not selected

This commit is contained in:
2024-12-23 09:35:22 +01:00
parent f9e829dce6
commit fc07c08c58

View File

@@ -1,13 +1,22 @@
import { Autocomplete, Box, TextField, Typography } from '@mui/material' import { Autocomplete, Box, TextField, Typography } from '@mui/material'
import { useAtomValue, useSetAtom } from 'jotai'
import { useEffect } from 'react'
import { customArgsState, savedTemplatesState } from '../atoms/downloadTemplate' import { customArgsState, savedTemplatesState } from '../atoms/downloadTemplate'
import { useI18n } from '../hooks/useI18n' import { useI18n } from '../hooks/useI18n'
import { useAtom, useAtomValue } from 'jotai'
const ExtraDownloadOptions: React.FC = () => { const ExtraDownloadOptions: React.FC = () => {
const { i18n } = useI18n() const { i18n } = useI18n()
const customTemplates = useAtomValue(savedTemplatesState) const customTemplates = useAtomValue(savedTemplatesState)
const [, setCustomArgs] = useAtom(customArgsState) const setCustomArgs = useSetAtom(customArgsState)
useEffect(() => {
setCustomArgs(
customTemplates
.find(f => f.name.toLocaleLowerCase() === 'default')
?.content ?? ''
)
}, [])
return ( return (
<> <>