Fixed warnings
This commit is contained in:
parent
fbb0dd7b32
commit
caa50709dd
@ -1,4 +1,4 @@
|
|||||||
import { useState, useContext, useEffect, useRef } from 'react'
|
import { useState, useContext, useEffect, useRef, useCallback } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Flex, Alert, Card, Spin, Splitter, Button, Modal, Input } from 'antd'
|
import { Flex, Alert, Card, Spin, Splitter, Button, Modal, Input } from 'antd'
|
||||||
import { LoadingOutlined } from '@ant-design/icons'
|
import { LoadingOutlined } from '@ant-design/icons'
|
||||||
@ -44,7 +44,8 @@ const TemplateEditor = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadPreview(content, testObject = {}, scale = 1) {
|
const reloadPreview = useCallback(
|
||||||
|
(content, testObject = {}, scale = 1) => {
|
||||||
fetchTemplatePreview(
|
fetchTemplatePreview(
|
||||||
objectData._id,
|
objectData._id,
|
||||||
content,
|
content,
|
||||||
@ -62,7 +63,9 @@ const TemplateEditor = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
|
[fetchTemplatePreview, objectData?._id]
|
||||||
|
)
|
||||||
|
|
||||||
// Move useEffect to component level and use state to track objectData changes
|
// Move useEffect to component level and use state to track objectData changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -70,7 +73,7 @@ const TemplateEditor = ({
|
|||||||
console.log('PreviewScale', previewScale)
|
console.log('PreviewScale', previewScale)
|
||||||
reloadPreview(objectData.content, objectData.testObject, previewScale)
|
reloadPreview(objectData.content, objectData.testObject, previewScale)
|
||||||
}
|
}
|
||||||
}, [objectData, previewScale])
|
}, [objectData, previewScale, reloadPreview])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user