react-boilerplate icon indicating copy to clipboard operation
react-boilerplate copied to clipboard

Use location instead of the undefined query property

Open kyusu opened this issue 6 years ago • 2 comments

Hi @richardscarrott,

I've found something which I consider a minor bug in your boilerplate. In the fetchComponentDatain the server.js you are destructuring the renderProps into query, params and history. But query is undefined. If I want to access the query parameters, I first have to get the location property and then access the query.

kyusu avatar Aug 17 '17 09:08 kyusu

Hmm, interesting the checks fail for files I haven't touched.

kyusu avatar Aug 17 '17 11:08 kyusu

@kyusu good catch... it also looks like history is undefined.

There doesn't appear to be much in the way of documentation for renderProps in the RR repo but I'm guessing it must have been removed when I upgraded to RR 3.x -- would you mind updating this to pass in just dispatch, params and the entire location object, e.g.

const { location, params } = renderProps;
      return (
        component
          .fetchData({
            dispatch: store.dispatch,
            location,
            params
          })
          // Make sure promise always successfully resolves
          .catch(() => {})
      );

re: CI, it looks like there's a mismatched version of prettier -- if you make the above change I'll fix that up and merge it in.

richardscarrott avatar Aug 17 '17 18:08 richardscarrott