Giter VIP home page Giter VIP logo

Comments (9)

srghma avatar srghma commented on May 18, 2024 1

seems like work for https://github.com/ktsn/vuex-toast

from legacy-modules.

Atinux avatar Atinux commented on May 18, 2024 1

@BjornMelgaard We are working with @pi0 on making vue-apollo work with Nuxt 1.0 out of the box :)

from legacy-modules.

pi0 avatar pi0 commented on May 18, 2024

Hi. The error section of apollo seems not a part of vue instance. Would you please check what is exactly this inside console function?

from legacy-modules.

srghma avatar srghma commented on May 18, 2024

its VueComponent

this.$error is undefined because ssr: false here

I think it can be handled with something like ... but it's weird

      error (error) {
        if (process.brower) {
          this.$error(error.message)
        } else {
          console.log(error.message)
        }
      }

from legacy-modules.

pi0 avatar pi0 commented on May 18, 2024

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.

from legacy-modules.

srghma avatar srghma commented on May 18, 2024

would like to see

or page can be rendered with toast notification (can it?)

from legacy-modules.

pi0 avatar pi0 commented on May 18, 2024

That's a good idea too.We need somehow inject state into window.__NUXT and retrieve it after rehydration.

from legacy-modules.

srghma avatar srghma commented on May 18, 2024

thing is that I dont understand why with this config (with-apollo, old nuxt)

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
and how to avoid this

P.S. I desperately need vue-apollo example with new nuxt 😭

from legacy-modules.

srghma avatar srghma commented on May 18, 2024

I know, and I wish you all the best in your affairs, I love you guys!!!

from legacy-modules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.