chore: memoize components (#607)

This commit is contained in:
Jeremy 2024-12-10 17:54:10 +05:30 committed by GitHub
parent 906d7d34da
commit 3df0fd4c0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 123 additions and 53 deletions

View file

@ -97,12 +97,10 @@ function PureBlockActions({
}
export const BlockActions = memo(PureBlockActions, (prevProps, nextProps) => {
if (
prevProps.block.status === 'streaming' &&
nextProps.block.status === 'streaming'
) {
return true;
}
if (prevProps.block.status !== nextProps.block.status) return false;
if (prevProps.currentVersionIndex !== nextProps.currentVersionIndex)
return false;
if (prevProps.isCurrentVersion !== nextProps.isCurrentVersion) return false;
return false;
return true;
});