Perf: Memoize SingleKeyframeEditor
This commit is contained in:
parent
10f21224f4
commit
8f08499fb6
2 changed files with 64 additions and 60 deletions
|
@ -95,7 +95,8 @@ const HitZone = styled.div<{isInlineEditorPopoverOpen: boolean}>`
|
|||
type ISingleKeyframeDotProps = ISingleKeyframeEditorProps
|
||||
|
||||
/** The ◆ you can grab onto in "keyframe editor" (aka "dope sheet" in other programs) */
|
||||
const SingleKeyframeDot: React.VFC<ISingleKeyframeDotProps> = (props) => {
|
||||
const SingleKeyframeDot: React.VFC<ISingleKeyframeDotProps> = React.memo(
|
||||
(props) => {
|
||||
const logger = useLogger('SingleKeyframeDot', props.keyframe.id)
|
||||
const presence = usePresence(props.itemKey)
|
||||
const [ref, node] = useRefAndState<HTMLDivElement | null>(null)
|
||||
|
@ -132,7 +133,8 @@ const SingleKeyframeDot: React.VFC<ISingleKeyframeDotProps> = (props) => {
|
|||
{contextMenu}
|
||||
</>
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export default SingleKeyframeDot
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ export type ISingleKeyframeEditorProps = {
|
|||
selection: undefined | DopeSheetSelection
|
||||
}
|
||||
|
||||
const SingleKeyframeEditor: React.VFC<ISingleKeyframeEditorProps> = (props) => {
|
||||
const SingleKeyframeEditor: React.VFC<ISingleKeyframeEditorProps> = React.memo(
|
||||
(props) => {
|
||||
const {
|
||||
index,
|
||||
keyframe,
|
||||
|
@ -55,6 +56,7 @@ const SingleKeyframeEditor: React.VFC<ISingleKeyframeEditorProps> = (props) => {
|
|||
{connected ? <SingleKeyframeConnector {...props} /> : noConnector}
|
||||
</SingleKeyframeEditorContainer>
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export default SingleKeyframeEditor
|
||||
|
|
Loading…
Reference in a new issue