-
Notifications
You must be signed in to change notification settings - Fork 158
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
[toast] support this.$error in SSR context #85
Comments
Hi. The error section of apollo seems not a part of vue instance. Would you please check what is exactly |
its VueComponent
I think it can be handled with something like ... but it's weird
|
But toast useless for SSR. We could redirect to console as an enhancement but the hard part is it should be removed from SSR bundle. |
would like to see or page can be rendered with toast notification (can it?) |
That's a good idea too.We need somehow inject state into window.__NUXT and retrieve it after rehydration. |
seems like work for https://github.com/ktsn/vuex-toast |
thing is that I dont understand why with this config ( import Vue from 'vue'
import { ApolloClient, createNetworkInterface } from 'apollo-client'
import 'isomorphic-fetch'
// Created with Graphcool - https://www.graph.cool/
const API_ENDPOINT = 'https://api.graph.cool/simple/v1/cj1dqiyvqqnmj0113yuqamkuu'
const apolloClient = new ApolloClient({
networkInterface: createNetworkInterface({
uri: API_ENDPOINT,
transportBatching: true
})
})
export default apolloClient application make only one request to api, on server side and with my config (new nuxt) import Vue from 'vue'
import VueApollo from 'vue-apollo'
import { ApolloClient, createNetworkInterface } from 'apollo-client'
Vue.use(VueApollo)
function createClient (ctx) {
const { isDev, isClient } = ctx
const networkInterface = createNetworkInterface({
uri: `${process.env.API_URL}/graphql`,
// uri: 'https://api.graph.cool/simple/v1/cj1dqiyvqqnmj0113yuqamkuu',
transportBatching: true
})
return new ApolloClient({
networkInterface,
connectToDevTools: isDev && isClient,
ssrMode: !isClient
})
}
export default (ctx) => {
const { app } = ctx
// if part dont work
if (!app.apolloProvider) {
app.apolloProvider = new VueApollo({
defaultClient: createClient(ctx)
})
}
} application makes two requests to api, one - on page rendering on server side, and one in browser P.S. I desperately need vue-apollo example with new nuxt 😭 |
@BjornMelgaard We are working with @pi0 on making vue-apollo work with Nuxt 1.0 out of the box :) |
I know, and I wish you all the best in your affairs, I love you guys!!! |
i have installed
@nuxtjs/toast
(nuxt version - 1.0.0-alpha.5) and i have exception, but only in terminal, on in browser, because ... full code hereThe text was updated successfully, but these errors were encountered: