fixed default template not selected
This commit is contained in:
@@ -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 (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user