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

fix(computed): When no dependencies are passed in, computed does not use the cache #12857 #12858

Closed
wants to merge 1 commit into from

Conversation

MKbird1
Copy link

@MKbird1 MKbird1 commented Feb 11, 2025

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

expected output a 1 1

@skirtles-code
Copy link
Contributor

I think this is attempting to solve the same problem as #12341.

I haven't looked at the differences between the two PRs in detail, so I don't know which fix is more correct.

@MKbird1 If you still want to proceed with this PR could you please add a test case? Bug fixes need to be accompanied by tests where possible. Thanks.

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+15 B) 38.1 kB (+2 B) 34.3 kB (+10 B)
vue.global.prod.js 158 kB (+15 B) 58 kB (+2 B) 51.6 kB (-59 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.5 kB (+15 B) 18.2 kB (+2 B) 16.7 kB (-5 B)
createApp 54.6 kB (+15 B) 21.3 kB (+1 B) 19.4 kB (+13 B)
createSSRApp 58.8 kB (+15 B) 23 kB (+2 B) 21 kB (+1 B)
defineCustomElement 59.4 kB (+15 B) 22.9 kB (+1 B) 20.8 kB (-13 B)
overall 68.6 kB (+15 B) 26.4 kB (+4 B) 24 kB

Copy link

pkg-pr-new bot commented Feb 12, 2025

Open in Stackblitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@12858

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@12858

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@12858

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@12858

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@12858

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@12858

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@12858

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@12858

@vue/shared

npm i https://pkg.pr.new/@vue/shared@12858

vue

npm i https://pkg.pr.new/vue@12858

@vue/compat

npm i https://pkg.pr.new/@vue/compat@12858

commit: a66a776

@edison1105 edison1105 added the need test The PR has missing test cases. label Feb 12, 2025
@MKbird1 MKbird1 closed this Feb 12, 2025
@MKbird1 MKbird1 deleted the edison/fix/12857 branch February 12, 2025 03:34
@edison1105 edison1105 removed the need test The PR has missing test cases. label Feb 12, 2025
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.

3 participants