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

Unmounting is not correctly handled #2

Open
ajmcgrail opened this issue Oct 31, 2024 · 1 comment
Open

Unmounting is not correctly handled #2

ajmcgrail opened this issue Oct 31, 2024 · 1 comment

Comments

@ajmcgrail
Copy link

I have added a test case here https://codesandbox.io/p/devbox/wild-wood-wfwxtn?workspaceId=4b08d1d7-1230-40b3-8d2d-b2981bb1e67f for convenience based off the README. To reproduce the problem, simply click the button that says HERE so that the draggable component is unmounted, and then after that adjust the size of the window in the editor (so that the screen is resized. There should be numerous errors that look like this:
image

This can be addressed with a change in DraggableResizableVue3.vue by adding

onUnmounted(() => {
  removeEvent(document.documentElement, 'mousedown', deselect)
  removeEvent(document.documentElement, 'touchend touchcancel', deselect)
  removeEvent(window, 'resize', checkParentSize)
})

to the component, although I do not know if it's a perfect solution.

@ajmcgrail
Copy link
Author

A CodeSandbox is here https://codesandbox.io/p/devbox/laughing-mclaren-ttqs6z?workspaceId=4b08d1d7-1230-40b3-8d2d-b2981bb1e67f using my fork here https://github.com/ajmcgrail/draggable-resizable-vue3/tree/ajmcgrail-patch-1 which shows the error no longer happening (though I'm not saying everything is correctly handled on unmount).

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

No branches or pull requests

1 participant