Fix : [#2986] Add ref callback#2988
Conversation
There was a problem hiding this comment.
Overall this looks good, but I'm not sure what to do with it because we've been working on some larger changes to the tables which would overwrite this. Specifically, the RenameInput and TableWithRename in #2382. (It's been so long that I don't even remember which parts were and were not finished).
If we have this problem in the CollectionListRow then odds are that we also have it in the SketchListRow. Those components are very similar and I don't like the current system where we have to make analogous changes in both places when we see an issue like this.
| ref={(node) => { | ||
| renameInput.current = node; | ||
| handleRenameFocus(); | ||
| }} |
There was a problem hiding this comment.
Does the ref function get executed every time that the element is mounted? Like if you open it and close it and open it again, will it get focused the second time? I think so but I'm not certain off the top of my head.
There was a problem hiding this comment.
will it get focused the second time?
Yes, it will. The way it works is when the component gets mounted the ref callback is called with the input field as an parameter. And when the component gets unmounted the callback is called again with null as an parameter.
The |
raclim
left a comment
There was a problem hiding this comment.
Thanks for your work on this!
Fixes #2986
Changes:
I have verified that this pull request:
npm run lint)npm run test)developbranch.