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

Vue-Rx prevents passing props as initial value to data #105

Open
19r3ka opened this issue Apr 25, 2019 · 0 comments
Open

Vue-Rx prevents passing props as initial value to data #105

19r3ka opened this issue Apr 25, 2019 · 0 comments

Comments

@19r3ka
Copy link

19r3ka commented Apr 25, 2019

Ever since I added VueRx to my project, I noticed that I can no longer pass props as initial values to data objects like so:

data() { return { foo: this.bar } }, props: { bar: String }

The lack of VueRx documentation, i.e. cookbook recipes, guides, makes it very hard to use. I tried to pass props as initial data using Observables like so const data$ = merge(new Observable(), this.$watchAsObservable('propName')). It works but then there is no way to get back the new values from data$ once it is returned by this function and used as v-model inside the template.

<template>
    <child v-model="data$" />
</template>
<script>
    props: ['propName'],
    subscriptions() {
        const data$ = merge(new Observable(), this.$watchAsObservable('propName'))
       const foo$ = data$.pipe(map(doSomething)) <-- it will on run that doSomething function on the first emission and nothing else despite data$ value changing when monitored with Vue Devtools.

        return {...}
    }
</script>

I would have expected that data$ observable to stream data and be usable in the subscriptions function.

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

No branches or pull requests

1 participant