Skip to content

Commit

Permalink
Fix admin titles
Browse files Browse the repository at this point in the history
  • Loading branch information
irdkwmnsb committed Apr 16, 2024
1 parent 7c7a190 commit 79a7c79
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/frontend/admin/src/components/Title.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ const PreviewSVGDialog = ({ id, ...props }) => {
const { enqueueSnackbar } = useSnackbar();
const service = useTitleWidgetService("/title", errorHandlerWithSnackbar(enqueueSnackbar), false);
const [content, setContent] = useState();
useEffect(() => props.open && service.getPreview(id).then(r => setContent(r.content)), [props.open, id]);
useEffect(() => {
if (props.open) {
service.getPreview(id).then(r => setContent(r.content));
}
}, [props.open, id]);
return (
<Dialog fullWidth maxWidth="md" { ...props }>
<DialogTitle>Title preview</DialogTitle>
Expand All @@ -53,7 +57,9 @@ const TemplateEditor = ({ value, onSubmit, onChange }) => {
const [templates, setTemplates] = useState([]);

const service = useTitleWidgetService("/title", undefined, false);
useEffect(() => service.getTemplates().then(ts => setTemplates(ts)), []);
useEffect(() => {
service.getTemplates().then(ts => setTemplates(ts));
}, []);

return (<Box onSubmit={onSubmit} component="form" type="submit">
<Autocomplete
Expand Down

0 comments on commit 79a7c79

Please sign in to comment.