Skip to content

Commit da3f4f3

Browse files
committed
Fix : [#2986] Add ref callback
1 parent 91e5b79 commit da3f4f3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

client/modules/IDE/components/CollectionList/CollectionListRow.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ const CollectionListRowBase = (props) => {
5555
closeAll();
5656
setRenameOpen(true);
5757
setRenameValue(props.collection.name);
58-
if (renameInput.current) {
59-
renameInput.current.focus();
60-
}
6158
};
6259

6360
const handleRenameChange = (e) => {
@@ -71,6 +68,12 @@ const CollectionListRowBase = (props) => {
7168
}
7269
};
7370

71+
const handleRenameFocus = () => {
72+
if (renameInput.current) {
73+
renameInput.current.focus();
74+
}
75+
};
76+
7477
const handleRenameBlur = () => {
7578
updateName();
7679
closeAll();
@@ -116,7 +119,10 @@ const CollectionListRowBase = (props) => {
116119
onKeyUp={handleRenameEnter}
117120
onBlur={handleRenameBlur}
118121
onClick={(e) => e.stopPropagation()}
119-
ref={renameInput}
122+
ref={(node) => {
123+
renameInput.current = node;
124+
handleRenameFocus();
125+
}}
120126
/>
121127
)}
122128
</>

0 commit comments

Comments
 (0)