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

chore: update test case to align with vue behavior #797

Merged
merged 2 commits into from
Feb 13, 2025

Conversation

alexzhang1030
Copy link
Member

since vuejs/core#11539, customRefs's value has cached, so we should access the value first.

see the logic of getObjectDetails

// ...
const value = toRaw(info.reactive ? object : tryGetRefValue(object))

/**
 * - ObjectRefImpl, toRef({ foo: 'foo' }, 'foo'), `_value` is the actual value, (since 3.5.0)
 * - GetterRefImpl, toRef(() => state.foo), `_value` is the actual value, (since 3.5.0)
 * - RefImpl, ref('foo') / computed(() => 'foo'), `_value` is the actual value
 */
function tryGetRefValue(ref: { _value?: unknown } | { value?: unknown }) {
  if (ensurePropertyExists<{ _value?: unknown }>(ref, '_value', true)) {
    return ref._value
  }
  if (ensurePropertyExists(ref, 'value', true)) {
    return ref.value
  }
}

Copy link

netlify bot commented Feb 12, 2025

Deploy Preview for vue-devtools-docs canceled.

Name Link
🔨 Latest commit 9a93c9b
🔍 Latest deploy log https://app.netlify.com/sites/vue-devtools-docs/deploys/67acc75d6c46d50008cbe7b8

Copy link

pkg-pr-new bot commented Feb 12, 2025

Open in Stackblitz

@vue/devtools-applet

npm i https://pkg.pr.new/@vue/devtools-applet@797

@vue/devtools-core

npm i https://pkg.pr.new/@vue/devtools-core@797

@vue/devtools-api

npm i https://pkg.pr.new/@vue/devtools-api@797

@vue/devtools

npm i https://pkg.pr.new/@vue/devtools@797

@vue/devtools-kit

npm i https://pkg.pr.new/@vue/devtools-kit@797

vite-plugin-vue-devtools

npm i https://pkg.pr.new/vite-plugin-vue-devtools@797

commit: 9a93c9b

@webfansplz webfansplz changed the title fix: tese case due to vue behavior changes chore: update test case align with vue behavior Feb 13, 2025
@webfansplz webfansplz changed the title chore: update test case align with vue behavior chore: update test case to align with vue behavior Feb 13, 2025
@webfansplz webfansplz merged commit 248a14a into vuejs:main Feb 13, 2025
8 checks passed
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.

2 participants