mirror of
https://github.com/langgenius/dify.git
synced 2026-04-22 03:37:44 +08:00
fix(skill-editor): resolve React Compiler memoization warnings
Wrap isEditable in useMemo to help React Compiler track its stability and preserve memoization for callbacks that depend on it. Also replace Record<string, any> with Record<string, unknown> to satisfy no-explicit-any.
This commit is contained in:
@ -48,7 +48,7 @@ const SkillDocEditor: FC = () => {
|
||||
const isImage = isImageFile(fileExtension)
|
||||
const isVideo = isVideoFile(fileExtension)
|
||||
const isOffice = isOfficeFile(fileExtension)
|
||||
const isEditable = isMarkdown || isCodeOrText
|
||||
const isEditable = useMemo(() => isMarkdown || isCodeOrText, [isMarkdown, isCodeOrText])
|
||||
|
||||
const {
|
||||
data: fileContent,
|
||||
@ -78,7 +78,7 @@ const SkillDocEditor: FC = () => {
|
||||
return
|
||||
if (dirtyMetadataIds.has(activeTabId))
|
||||
return
|
||||
let nextMetadata: Record<string, any> = {}
|
||||
let nextMetadata: Record<string, unknown> = {}
|
||||
if (fileContent.metadata) {
|
||||
if (typeof fileContent.metadata === 'string') {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user