How to use the mst-gql.getDataFromTree function in mst-gql

To help you get started, we’ve selected a few mst-gql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mobxjs / mst-gql / examples / 5-nextjs / pages / _app.tsx View on Github external
static async getInitialProps({ Component, ctx, router }) {
    const store = getStore()

    const pageProps =
      (Component.getInitialProps &&
        (await Component.getInitialProps({ ...ctx, store }))) ||

    let storeSnapshot
    if (isServer) {
      const tree = 
      await getDataFromTree(tree, store)
      storeSnapshot = getSnapshot(store)

    return { pageProps, storeSnapshot }