drupal-graphql / drupal-graphql/drupal-decoupled-app

Server Side Rendering

Open
#417 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
310
Forks
77
PR merge metrics
No merged PRs in 30d

Description

If I fetch something from the GraphQL-Server I get from the Server-Side-Rendering `

loading...
` instead of my data. Any idea how to make the SSR waiting for the data?

```jsx
// home.jsx
...
import query from "./query.gql";
import withApollo from "~/shared/withApollo";

export const Home: StatelessComponent<{}> = ({ loading, entities }) => {
console.log('entities', entities)

if (loading) {
return

loading...
;
}

return (

{entities.map(item => "...")}

);
};

const withQuery = graphql(query, {
props: ({ ownProps, data }) => ({
...ownProps,
entities: data.nodeQuery && data.nodeQuery.entities,
loading: data.loading
})
});

// export default Home;
export default compose(withApollo, withQuery)(Home);

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.