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

added is executed before removed in @change event #247

Open
soufianekhait opened this issue Nov 13, 2023 · 0 comments
Open

added is executed before removed in @change event #247

soufianekhait opened this issue Nov 13, 2023 · 0 comments

Comments

@soufianekhait
Copy link

Code snippet

const onChange = ({ added, removed }) => {
  if (added) {
    api.put(/resource, payload)
      .then(res => {
        api.get(/something)
          .then(res => {
            emit('count', res.data.length)
          })
      })
  }

  if (removed) {
    api.get(/something)
      .then(res => {
        emit('count', res.data.length)
      })
  }
}

Step by step scenario

I'm trying to PUT data on the server and GET other resources when the PUT request has succeeded. @change event triggers onChange function when Im draging/dropping items.

Actual Solution

The behavior of execution of removed and added is random. Sometimes, the removed is executed before added property and vice-versa.

Expected Solution

Is there a way to make sure added is triggered before removed?

@soufianekhait soufianekhait changed the title added property is executed before removed property in @change event added is executed before removed in @change event Nov 13, 2023
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