Skip to content

Keep computeds lazy when passed via slot props #4192

@backbone87

Description

@backbone87

Version

3.2.0-beta.5 (but applies basically to ^2 & ^3)

Reproduction link

https://sfc.vuejs.org/

Steps to reproduce

See the reproduction for various cases on how to pass computeds via slot props.

What is expected?

Ideally that all variants in the reproduction keep the computeds lazy until actually used.

What is actually happening?

In the most idiomatic way (EagerUppercase) computeds are evaluated when passed to slot even if they are not used. The other variants also have drawbacks or are not lazy.


  • Its probably not possible to make the EagerUppercase variant lazy by default.
  • The LazyUppercaseThis variant is to be avoided since it passes the whole child component instance. Also there is a warning generated when using this variant: Property "key" was accessed during render but is not defined on instance. at <LazyUppercaseThismsg="foo"> at <App>
  • LazyUppercase works, but requires one to access everything with Ref.value in the template (e.g. uppercase.value)
  • LazyUppercaseReactive would be acceptable, but is not lazy

Metadata

Metadata

Assignees

No one assigned

    Labels

    🍰 p2-nice-to-havePriority 2: this is not breaking anything but nice to have it addressed.✨ feature requestNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions