File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 1
1
import { action , computed , makeObservable , observable } from 'mobx' ;
2
2
import { JSXElement } from '@babel/types' ;
3
3
import {
4
- array2object ,
5
4
ComponentPrototypeType ,
6
5
hasFileExtension ,
7
6
isString ,
@@ -16,7 +15,6 @@ import {
16
15
getJSXElementChildrenNames ,
17
16
namesToImportDeclarations ,
18
17
getBlockNameByFilename ,
19
- getPrivilegeCode ,
20
18
prototype2importDeclarationData ,
21
19
} from '../helpers' ;
22
20
import { DropMethod } from './drop-target' ;
Original file line number Diff line number Diff line change @@ -148,6 +148,12 @@ export const ComponentsTree: React.FC<ComponentsTreeProps> = observer(
148
148
setSelectedKeys ( workspace . selectSource . selected . map ( ( item ) => item . id ) ) ;
149
149
} , [ workspace . selectSource . selected ] ) ;
150
150
151
+ useEffect ( ( ) => {
152
+ setExpandedKeys ( getNodeKeys ( nodesTree ) ) ;
153
+ // nodeTree 更新后重新计算expandKeys
154
+ // eslint-disable-next-line react-hooks/exhaustive-deps
155
+ } , [ nodesTree ?. [ 0 ] ?. id ] ) ;
156
+
151
157
if ( ! nodesTree . length ) {
152
158
return (
153
159
< Box >
@@ -156,12 +162,6 @@ export const ComponentsTree: React.FC<ComponentsTreeProps> = observer(
156
162
) ;
157
163
}
158
164
159
- useEffect ( ( ) => {
160
- setExpandedKeys ( getNodeKeys ( nodesTree ) ) ;
161
- // nodeTree 更新后重新计算expandKeys
162
- // eslint-disable-next-line react-hooks/exhaustive-deps
163
- } , [ nodesTree ?. [ 0 ] ?. id ] ) ;
164
-
165
165
return (
166
166
< Box css = { outlineStyle } >
167
167
< Tree
@@ -230,4 +230,4 @@ export const ComponentsTree: React.FC<ComponentsTreeProps> = observer(
230
230
</ Box >
231
231
) ;
232
232
} ,
233
- ) ;
233
+ ) ;
You can’t perform that action at this time.
0 commit comments