Subscribe on changes!

cleanupEffect missing edge test case

avatar
Mar 8th 2022

Version

3.2.31

Reproduction link

github.com

Steps to reproduce

I want to optimize cleanupEffect code ,and when i changed the code,the tests all passed,that makes me think my change is right,but actually, it's wrong

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
  }
}

What is expected?

All tests should fail

What is actually happening?

All tests passed


I want to optimize cleanupEffect code ,and when i changed the code,the tests all passed,that makes me think my change is right,but actually, it's wrong

avatar
Mar 8th 2022

#5537 add edge test case