mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
fix(code-editor): improve template handling and default value logic
This commit is contained in:
parent
556fde6546
commit
a691992404
@ -66,8 +66,8 @@ export default function CodeEditor({
|
||||
if (storedValue !== null) {
|
||||
setValue(storedValue);
|
||||
} else {
|
||||
const template = templates.find((t) => t.language === language);
|
||||
if (template) setValue(template.template);
|
||||
const currentTemplate = templates.find((t) => t.language === language)?.template ?? "";
|
||||
setValue(currentTemplate);
|
||||
}
|
||||
}, [valueStorageKey, setValue, templates, language])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user