mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-29 17:32:43 +00:00
Fix preset not reloading in some cases
This commit is contained in:
@@ -42,6 +42,11 @@ export function Generator({ lang, changeTitle, version, changeVersion }: Generat
|
|||||||
|
|
||||||
const searchParams = getSearchParams(getCurrentUrl())
|
const searchParams = getSearchParams(getCurrentUrl())
|
||||||
const currentPreset = searchParams.get('preset')
|
const currentPreset = searchParams.get('preset')
|
||||||
|
useEffect(() => {
|
||||||
|
if (model && currentPreset) {
|
||||||
|
selectPreset(currentPreset)
|
||||||
|
}
|
||||||
|
}, [currentPreset])
|
||||||
|
|
||||||
const [model, setModel] = useState<DataModel | null>(null)
|
const [model, setModel] = useState<DataModel | null>(null)
|
||||||
const [blockStates, setBlockStates] = useState<BlockStateRegistry | null>(null)
|
const [blockStates, setBlockStates] = useState<BlockStateRegistry | null>(null)
|
||||||
|
|||||||
@@ -417,7 +417,6 @@ function StringSuffix({ path, getValues, config, node, value, lang, version, sta
|
|||||||
} else {
|
} else {
|
||||||
const datalistId = hexId()
|
const datalistId = hexId()
|
||||||
const gen = id ? findGenerator(id) : undefined
|
const gen = id ? findGenerator(id) : undefined
|
||||||
console.log(id, gen)
|
|
||||||
return <>
|
return <>
|
||||||
<input value={value ?? ''} onBlur={onChange} onKeyDown={evt => {if (evt.key === 'Enter') onChange(evt)}}
|
<input value={value ?? ''} onBlur={onChange} onKeyDown={evt => {if (evt.key === 'Enter') onChange(evt)}}
|
||||||
list={values.length > 0 ? datalistId : ''} />
|
list={values.length > 0 ? datalistId : ''} />
|
||||||
|
|||||||
Reference in New Issue
Block a user