diff --git a/src/pages/Note/Hlexical/index.jsx b/src/pages/Note/Hlexical/index.jsx index e21375b..2e9d7e3 100644 --- a/src/pages/Note/Hlexical/index.jsx +++ b/src/pages/Note/Hlexical/index.jsx @@ -47,12 +47,10 @@ export default function Hlexical(props) { }, nodes: UsefulNodes }; - const [spinningState,setSpinningState]=useState(true) + const [spinningState,setSpinningState]=useState(!isEmpty(props.filePath)) console.log("Hlexical(props):this.props.filePath:", props.filePath) if (!isEmpty(props.filePath)&&props.filePath.endsWith(".md")){ - let promise = importFile(props.filePath); - promise.then(value => { if (isEmpty(value)) { return diff --git a/src/pages/Note/index.jsx b/src/pages/Note/index.jsx index dc7951d..2afb7c7 100644 --- a/src/pages/Note/index.jsx +++ b/src/pages/Note/index.jsx @@ -55,7 +55,7 @@ const Note = () => { }; const remove = (targetKey) => { console.log("remove = (targetKey):",targetKey) - let newActiveKey = activeKey; + let lastIndex = -1; items.forEach((item, i) => { if (item.key === targetKey) { @@ -64,7 +64,8 @@ const Note = () => { }); dispatch(removeTableBarItem(targetKey)); const newPanes = items.filter((item) => item.key !== targetKey); - if (newPanes.length && newActiveKey === targetKey) { + let newActiveKey; + if (newPanes.length) { if (lastIndex >= 0) { newActiveKey = newPanes[lastIndex].key; } else { diff --git a/src/redux/tableBarItem_reducer.js b/src/redux/tableBarItem_reducer.js index aa3b55a..9739b3a 100644 --- a/src/redux/tableBarItem_reducer.js +++ b/src/redux/tableBarItem_reducer.js @@ -38,9 +38,7 @@ export const tableBarItemSlice = createSlice({ }, setActiveKey: (state, action) => { console.log("tableBarItemSlice:setActiveKey",action.payload) - if (action.payload.activeKey){ - state.activeKey=action.payload.activeKey - } + state.activeKey=action.payload.activeKey }, updateFileName:(state,action)=>{ console.log("tableBarItemSlice:updateFileName", state, action)