diff --git a/Changelog.md b/Changelog.md index b4f0a7eab..5d513ab9f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,6 +17,8 @@ - 修复 JS 脚本验证因 console 方法调用导致的执行失败问题 - 修复 macOS 内存压力下 WebView 渲染进程被系统终止引发的白屏与主进程内存泄漏 - 删除覆盖全局热键开关的冗余写入 +- 修复编辑节点下base64解码未能正确处理非ASCII字符 +- 修复订阅规则编辑器自定义规则偶发显示为空的问题
✨ 新增功能 diff --git a/src/components/profile/rules-editor-viewer.tsx b/src/components/profile/rules-editor-viewer.tsx index fac32b481..1773db07f 100644 --- a/src/components/profile/rules-editor-viewer.tsx +++ b/src/components/profile/rules-editor-viewer.tsx @@ -276,6 +276,7 @@ export const RulesEditorViewer = (props: Props) => { const [prependSeq, setPrependSeq] = useState([]) const [appendSeq, setAppendSeq] = useState([]) const [deleteSeq, setDeleteSeq] = useState([]) + const hasLoadedSeqConfigRef = useRef(false) const filteredPrependSeq = useMemo( () => prependSeq.filter((rule) => match(rule)), @@ -406,6 +407,7 @@ export const RulesEditorViewer = (props: Props) => { } } const fetchContent = useCallback(async () => { + hasLoadedSeqConfigRef.current = false const data = await readProfileFile(property) const obj = yaml.load(data) as ISeqProfileConfig | null @@ -415,6 +417,7 @@ export const RulesEditorViewer = (props: Props) => { setPrevData(data) setCurrData(data) + hasLoadedSeqConfigRef.current = true }, [property]) useEffect(() => { @@ -432,11 +435,19 @@ export const RulesEditorViewer = (props: Props) => { // 优化:异步处理大数据yaml.dump,避免UI卡死 useEffect(() => { + if (!hasLoadedSeqConfigRef.current) { + return + } + if (!(prependSeq && appendSeq && deleteSeq)) { return } const serialize = () => { + if (!hasLoadedSeqConfigRef.current) { + return + } + try { setCurrData( yaml.dump(