-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<React.StrictMode>-compliance #1739
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for working on this 👍
/> | ||
)} | ||
</div> | ||
<DragAndDropContext.Consumer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should use static contextType
where possible to avoid the extra component and instance assigning in the render fn
src/TimeGrid.js
Outdated
} | ||
|
||
UNSAFE_componentWillReceiveProps(nextProps) { | ||
componentDidUpdate(prevProps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some of this should be in a getSnapshotBeforeUpdate hook, it's important that the measuring code run before render
src/TimeGrid.js
Outdated
componentDidMount() { | ||
this.calculateScroll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment below
@jquense Thanks for the feedback, even learned a few new tricks in the process! Please take a look at the new commits when you have some time available. Any thoughts on the remaining findDOMNode() in EventContainerWrapper? |
Not sure i understand specifically what you mean here. Adding a ref via cloneElement works well enough. Is the concern that it would override an existing ref, or that the ref may be passed to a function component? For the former case |
@jquense My mistake, I was of the impression that EventContainerWrapper expected an array of children, but it's a single child element, which made this a trivial fix. The |
render( | ||
<React.StrictMode> | ||
<Example /> | ||
</React.StrictMode>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets not add this to the examples
there are a few places where code was switched to |
Couldn't we throw the |
any chances to get this merged? |
Any updates on this? It's been a while, and it would be great to be able to use this library in StrictMode without errors. |
Wow, what a blast from the past! Awesome to finally get this merged though 👍🏻 |
In reference to #1200 I've started on removing references to
findDOMNode()
.I've gotten ridd of all of them except one in
EventContainerWrapper
, which needs a larger rethink due to refs not working quite the same asfindDOMNode()
with components that useReact.cloneElement()
inrender()
.I've also converted the draggable context from the legacy format to using
React.createContext()
. A larger rewrite would probably be necessary to bring this part of the code base more in line with modern React, but this works for now.Finally, I've replaced
UNSAFE_componentWillReceiveProps()
withcomponentDidUpdate()
andgetDerivedStateFromProps()
equivalents.