Skip to content

[Composition API] Cannot read property 'value' of undefined when using useSubscription #903

@kabukki

Description

@kabukki

Describe the bug
A simple call to useSubscription throws an Error, but the subscription still seems to work.

To Reproduce
Use useSubscription anywhere.

Example:
useSubscription(require('@/graphql/map/subMoved.gql'));
If that matters, here are the file contents:

subscription subMoved {
    moved {
        character {
            id
        }
        position
    }
}

Expected behavior
No error should be happening

Versions
vue: 2.6.10
vue-apollo: 3.0.0-beta.11
@vue/composition-api: 0.3.4
apollo-client: 2.6.8

Additional context

vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in callback for immediate watcher "function () { return source.value; }": "TypeError: Cannot read property 'value' of undefined"
TypeError: Cannot read property 'value' of undefined
    at updateRestartFn (useSubscription.js?801b:100)
    at restart (useSubscription.js?801b:112)
    at eval (useSubscription.js?801b:119)
    at applyCb (vue-composition-api.module.js?750b:911)
    at shiftCallback_1 (vue-composition-api.module.js?750b:920)
    at VueComponent.callback (vue-composition-api.module.js?750b:923)
    at VueComponent.Vue.$watch (vue.runtime.esm.js?2b0e:4949)
    at createWatcher (vue-composition-api.module.js?750b:927)
    at Module.watch (vue-composition-api.module.js?750b:963)
    at useSubscription (useSubscription.js?801b:117)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions