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

Define callback refs inline to work with latest versions of Next.js / React #942

Merged
merged 1 commit into from
May 26, 2024

Conversation

jmurty
Copy link
Contributor

@jmurty jmurty commented May 24, 2024

Callback refs defined as class functions don't get invoked in Next.js 14.2+ – and therefore don't work – perhaps because of changes to the underlying React which is at or near version 19.

This should fix #941 along with the related PR on re-resizable: bokuweb/re-resizable#819

Tested and confirmed to work with the latest stable version of Next.js 14.2.3

… React

Callback refs defined as class functions don't get invoked in
Next.js 14.2+ – and therefore don't work – perhaps because of changes
to the underlying React which is at or near version 19.
@jmurty
Copy link
Contributor Author

jmurty commented May 24, 2024

Thanks very much for this awesome library bokuweb! It's vital to a big project of ours where we are using it to do some pretty cool things, which will be made public soon.

Unfortunately – along with so many other libraries and issues – updates to Next.js (and/or maybe React?) break this library for recent versions of that framework.

I found that moving callback ref function definitions to be inline when used with a component, instead of class functions, was enough to fix our Next 14.2.3 project. I don't know why this change was necessary, I've searched but haven't found anyone else talking about changes to how callback refs can/should be defined or how they work.

Please consider merging in this change – and the very similar related change in bokuweb/re-resizable#819 – so we and others can continue to benefit from this great work.

Let me know if you need any more info, or would like me to change these PRs.

@bokuweb bokuweb merged commit 5f5d2e7 into bokuweb:master May 26, 2024
2 checks passed
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.

Error: <DraggableCore> not mounted on DragStart! when trying to use in NextJS
2 participants