Skip to content
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

Fix react18 concurrent mode drag glitch due to state inconsistency #699

Merged
merged 2 commits into from Sep 27, 2023

Conversation

erictheswift
Copy link
Contributor

fixes #698

@maxwellwalin
Copy link

Confirmed that it solved the same issue I was having when I upgraded to React 18.

@DeepAnchor
Copy link

This fixed an issue I was having when dragging an item very quickly across the screen.

As in #698, the dragged item would move progressively further and further away from the cursor proportionate to the dragging acceleration (which makes sense since this issue is caused by React 18 batching).

Thanks @erictheswift for investigating and fixing this!

LGTM

@tnrich
Copy link
Contributor

tnrich commented Sep 25, 2023

@STRML can we please get this on in? Thank you!

@STRML
Copy link
Collaborator

STRML commented Sep 26, 2023

Assigning directly to state is a pretty bad habit.

That said, you are correct that this data is not used for rendering, so it shouldn't be on this.state at all! Instead, it should simply held as local variables on the component.

If you make that change, I'll merge it.

@erictheswift
Copy link
Contributor Author

Agree)
My initial intent was to make patch be as minimum surface area as possible

@erictheswift
Copy link
Contributor Author

@STRML done

@STRML STRML merged commit 108e344 into react-grid-layout:master Sep 27, 2023
@STRML
Copy link
Collaborator

STRML commented Sep 27, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix React 18 Concurrent Mode drag glitches
5 participants