Skip to content

toRaw - should cover all reactive objects ( ref, reactive,computed, etc) #4212

@lidlanca

Description

@lidlanca

What problem does this feature solve?

toRaw() allow for an "escape hatch" to access the raw value of reactive proxy , however there is no equivalent support for other "reactive" objects such as ref or computed.

ref and reactive are already mingled internally

let refThatActuallyWrapsReactiveObject = ref({a:1})

supporting a common way to access raw values of any of the supported *reactive envelopes types will improve the framework abilities to work with reactive objects and allow for greater control for developers.

What does the proposed API look like?

toRaw(obj: Reactive|Ref|Computed|... )

ref should be straight forward implementation

isRef(obj) {
 return obj._rawValue
}

computed is lazily evaluated, and toRaw should probably be as transparent as possible and should not trigger any effects or possibly the evaluation of the getter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions