Skip to content

When no dependencies are passed in, computed does not use the cache. #12857

Closed as duplicate of#12337
@MKbird1

Description

@MKbird1

Vue version

3.5

Link to minimal reproduction

https://play.vuejs.org/#eNqNUctOwzAQ/JWVL0nVKgjBqWorAeoBDoCAoy9Wug0pjm35ESpF+XfWjhJaCRA3a2Z2PLPbsRtjijYgW7KVK21tPDj0wWy4qhujrYcOLIrS1y0uSt2Y4HEHPeytbiCjwYyrUitHY154hPWkzjuuAMQSLrnqZ2equ9FnDaNlns9gvYE0E5VaYiF1lWcio1kgVx+sOvUaFWeORStkQFIktBDz+X/Eq4uhOpVeeWyMJBG9ASI1AWzBvCOzfV0VB6cVrSzF5SyWqCXaJ+Nr+oyz5VAkckJK/fmQMG8DLka8fMfy4wf84I4R4+zZokPbImcT54Wt0A/09vURj/SeyEbvgiT1H+QL0iJCzDjIboPaUewTXUp7nw5fq+rNbY8elRtLxaBR2Sc9Z3T+uMvfqn/HvSqu0xxdj/Vfdv/Vcg==

Steps to reproduce

<script setup>
import { reactive,computed } from 'vue'
const state = reactive({
  a: 1
})
const stateComputed = computed(() => {
  console.log('a')
  return 1
})
console.log(stateComputed.value)
state.a++
console.log(stateComputed.value)
</script>

What is expected?

print a 1 1

What is actually happening?

print a 1 a 1

System Info

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions