Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

The whole site fails when a single SSR query fails. #1253

Closed
coyolero opened this issue Oct 19, 2017 · 7 comments
Closed

The whole site fails when a single SSR query fails. #1253

coyolero opened this issue Oct 19, 2017 · 7 comments

Comments

@coyolero
Copy link

coyolero commented Oct 19, 2017

I'm using the example from code here for SSR.

import { renderToStringWithData } from "react-apollo"
const client = new ApolloClient(....);

renderToStringWithData(app).then((content) => {
  const initialState =  client.getInitialState();
  const html = <Html content={content} state={initialState} />;
  res.status(200);
  res.send(`<!doctype html>\n${ReactDOM.renderToStaticMarkup(html)}`);
  res.end();
});

It works great, now all my components that have the graphql HOC will retrieve the data.

But, if I a query fails, the whole site will crash because of a single fail on a query.

Intended outcome:
If a query fails, I should be able to handle that error.
The site should continue working normally but without that piece of data.

Version

  • react-apollo@1.4.15
@stale
Copy link

stale bot commented Nov 9, 2017

This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!

@coyolero coyolero changed the title Get defaults values when a query fails on SSR The whole site fails when a single SSR query fails. Nov 9, 2017
@coyolero
Copy link
Author

coyolero commented Nov 9, 2017

@jbaxleyiii

Am I missing some other configuration?

@stale
Copy link

stale bot commented Nov 30, 2017

This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!

@flippidippi
Copy link

Having this issue also. It's hard to pinpoint exactly where the error needs to be fixed, but I do know before apollo-link-http 1.3.2 it's fine and doesn't crash.

@amannn
Copy link
Contributor

amannn commented Mar 28, 2018

There's an existing issue about this: #615. It's been closed due to inactivity, but I think it's still important.

@amannn
Copy link
Contributor

amannn commented Feb 27, 2019

Apparently this is fixed now. I didn't have time to verify this yet though.

@hwillson
Copy link
Member

This should no longer be an issue with current day react-apollo. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants