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

add onstart callback fetaure #182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

2ue
Copy link

@2ue 2ue commented Aug 20, 2024

In the onStart method, you may need to interrupt dragging or placing elements, or rendering and placing elements requires obtaining data from the terminal, so the following is added:

  1. Allow the clone method to be an asynchronous function
  2. Add the return type of clone method: Promise and false can be returned. When false is returned, it will not be updated.

Copy link

netlify bot commented Aug 20, 2024

Deploy Preview for vue-draggable-plus ready!

Name Link
🔨 Latest commit f12a557
🔍 Latest deploy log https://app.netlify.com/sites/vue-draggable-plus/deploys/66c5503da008750008ae6175
😎 Deploy Preview https://deploy-preview-182--vue-draggable-plus.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Alfred-Skyblue
Copy link
Owner

This asynchronous behavior may lead to the correct value not being obtained if the promise has not been resolved when the update is triggered.

@2ue
Copy link
Author

2ue commented Aug 21, 2024

This asynchronous behavior may lead to the correct value not being obtained if the promise has not been resolved when the update is triggered.

This asynchronous behavior may lead to the correct value not being obtained if the promise has not been resolved when the update is triggered.

Yes. I've updated this method to use Promise. resolve to ensure the return value is as expected

@Alfred-Skyblue
Copy link
Owner

If it's asynchronous, then no other events should be triggered before the promise is resolved. If that's the case, it could cause the view to be blocked, which I personally think is not a reasonable requirement.

@2ue
Copy link
Author

2ue commented Aug 26, 2024

If it's asynchronous, then no other events should be triggered before the promise is resolved. If that's the case, it could cause the view to be blocked, which I personally think is not a reasonable requirement.

Yes. Asynchronous may cause render to be blocked(maybe blocked to be wanted really?). We can also render page by asynchronous data after the element is placed, but it will cause rendered twice. Is it bad? so I want to solve it on start.

In fact, delayed rendering after dragging (may need to be combined with remote data for page rendering, may require the user to input again for confirmation, etc.) is also a normal requirement. For example

  1. Drag and drop to render remote components
  2. Before placed, user needs to input some information.
  3. Remote data needs to be verified before be placed.

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.

2 participants