Skip to content

Commit

Permalink
feat: 修复报错白屏问题
Browse files Browse the repository at this point in the history
  • Loading branch information
heiyexing committed Aug 27, 2024
1 parent 9d4cfce commit 1807cb3
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/recoil/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,20 @@ export default function useFeature() {
2,
);
let newFeatures: Feature[] = [];
if (editorText || value) {
newFeatures = transformFeatures(value ?? editorText, t);
if (value) {
setEditorText(value);
try {
if (editorText || value) {
newFeatures = transformFeatures(value ?? editorText, t);
if (value) {
setEditorText(value);
}
setSavedText(value ?? editorText);
setFeatures(newFeatures as IFeatures);
} else {
setEditorText(emptyFeatures);
setSavedText(emptyFeatures);
}
setSavedText(value ?? editorText);
setFeatures(newFeatures as IFeatures);
} else {
setEditorText(emptyFeatures);
setSavedText(emptyFeatures);
} catch (e) {
console.log(e);
}
return newFeatures;
};
Expand Down

0 comments on commit 1807cb3

Please sign in to comment.