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: Ref or computed inside non-wrappable variables (objects, arrays) should return a string without quotes(#5578) #5593

Closed
wants to merge 1 commit into from

Conversation

zscumt123
Copy link
Contributor

fix: Ref or computed inside non-wrappable variables (objects, arrays) should return a string without quotes(#5578)

@netlify
Copy link

netlify bot commented Mar 16, 2022

✔️ Deploy Preview for vue-sfc-playground ready!

🔨 Explore the source changes: 4d3d0d6

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-sfc-playground/deploys/6231a7aea7b45c0009a09d74

😎 Browse the preview: https://deploy-preview-5593--vue-sfc-playground.netlify.app/

@netlify
Copy link

netlify bot commented Mar 16, 2022

✔️ Deploy Preview for vuejs-coverage ready!

🔨 Explore the source changes: 4d3d0d6

🔍 Inspect the deploy log: https://app.netlify.com/sites/vuejs-coverage/deploys/6231a7ae9fb66100087d3e17

😎 Browse the preview: https://deploy-preview-5593--vuejs-coverage.netlify.app

@netlify
Copy link

netlify bot commented Mar 16, 2022

✔️ Deploy Preview for vue-next-template-explorer ready!

🔨 Explore the source changes: 4d3d0d6

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-next-template-explorer/deploys/6231a7ae7c9dc00008fc31d7

😎 Browse the preview: https://deploy-preview-5593--vue-next-template-explorer.netlify.app

@LinusBorg
Copy link
Member

I'm no sure that this is the right kind of solution to the issue.

While it gets rid of the quotes, it might lead to even more confusion:

<script setup>
import { ref } from 'vue'
const obj = {
  flag = ref(false)
}
</script>
<template>
  <div v-if="obj.flag">
      this should be hidden but isn't, because `obj.flag` returns the ref, not the ref's value
  </div>

  <!-- the following will print `false`, giving the impression that `obj.flag` is returning the boolean value -->
  <p>{{ obj.flag }}</p>
</template>

export const toDisplayString = (val: unknown): string => {
export const toDisplayString = (val: any): string => {
//fix #5578
if (val && val.__v_isRef) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val?.__v_isRef ?)

@yyx990803
Copy link
Member

Thanks a lot for the PR - please see #7306 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

4 participants