question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Ref` value returned by function won't get unwrapped

See original GitHub issue

Version

3.2.31

Reproduction link

codesandbox.io

Steps to reproduce

  1. refer a Ref value returned by a function in <template>
  2. confirm that the returned value won’t get unwrapped automatically

What is expected?

expect this will work.

<template>
  <pre v-html="getVal()"></pre>
</template>

What is actually happening?

I have to unwrap the value myself:

<template>
  <pre v-html="getVal().value"></pre>
</template>

x

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ygj6commented, Feb 24, 2022

Hi @posva @caozhong1996 I have read the doc page you provided. But I couldn’t see why this is expected. What’s the reason for this?

Unwrapping occurs in the compilation phase,Unable to process return value of function.

0reactions
yaquawacommented, Feb 24, 2022

@ygj6 Got it, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

vuejs/composition-api - Unwrap ref from function in template
I have function(fn) which return ref, but this ref will not unwrapped in template: I want to have similar result as for fn2...
Read more >
Cannot move out of value which is behind a shared reference ...
Option::unwrap() consumes the option, that is, it accepts the option by value. However, you don't have a value, you only have a reference...
Read more >
Vue 3 Composition API: How to Omit `.value` in refs
In this article, we discuss how to omit in VueJS refs, creating APIs by converting them into reactive variables using macros.
Read more >
Prevent unpacking of ref w. composition API - Vue Forum
When using vue3 with the new composition API and the ref function, when returning the refs into the tempalte, the refs get unpacked...
Read more >
Built-in function reference - Puppet
This page is a list of Puppet's built-in functions, with descriptions of what they do and how to use them. Functions are plugins...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found