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

How to reference smartquery key from result()? #445

Closed
fnoop opened this issue Nov 16, 2018 · 2 comments
Closed

How to reference smartquery key from result()? #445

fnoop opened this issue Nov 16, 2018 · 2 comments

Comments

@fnoop
Copy link
Contributor

fnoop commented Nov 16, 2018

I'm trying to dynamically create smart queries to connect to multiple instances of the same backend API (connect to multiple servers running the same schema). This works:

this.$apollo.addSmartQuery('navSatFixMessage_' + api, {
        client: api,
        query: navSatFixQuery,
        manual: true,
        result (data) {
            this.navSatFixData[api] = data
        }
      })

Except that navSatFixData always ends up with a single element (the last value of api). Is there any way of retrieving the query key from the data passed to result, or from this.vm which is set as this value when calling result()?

Or would this require changing the call with the key as a second calling parameter?

Or can I override QueryResult somehow and stuff the key into the data, so it's passed to result that way?

@fnoop
Copy link
Contributor Author

fnoop commented Nov 16, 2018

Unless there's a better way of connecting a vue app to multiple graphql servers with the same schema?

fnoop added a commit to fnoop/vue-apollo that referenced this issue Nov 18, 2018
@fnoop
Copy link
Contributor Author

fnoop commented Nov 18, 2018

Very simple fix - PR raised: #448

fnoop added a commit to fnoop/vue-apollo that referenced this issue Dec 2, 2018
fnoop added a commit to fnoop/vue-apollo that referenced this issue Dec 2, 2018
@Akryum Akryum closed this as completed in 5a92745 Jan 9, 2019
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