Subscribe on changes!

repeat delete effect & redundant loop

avatar
Mar 7th 2022

What problem does this feature solve?

Optimized code execution efficiency

What does the proposed API look like?

before:

function cleanupEffect(effect: ReactiveEffect) {
  const { deps } = effect
  if (deps.length) {
    for (let i = 0; i < deps.length; i++) {
      deps[i].delete(effect)
    }
    deps.length = 0
  }
}

now:

function cleanupEffect(effect: ReactiveEffect) {
  const { deps } = effect
  if (deps.length) {
    deps[0].delete(effect)
    deps.length = 0
  }
}
avatar
Mar 7th 2022

#5521

avatar
Mar 7th 2022

Hello, make sure to always provide a reproduction that follows the instructions at https://new-issue.vuejs.org/?repo=vuejs/vue-next#why-repro.

Open a new issue with a reproduction that follows those instructions if you manage to create a boiled-down reproduction or provide a failing test case at https://github.com/vuejs/core/pull/5537 (Currently your test passes)