relay-tools/react-router-relay

router.push vs router.replace

fersman opened this issue · 1 comments

I have issues with react-router-relay and router.replace(). If I use router.replace(), I get this error:

Warning: RelayContainer: component MinifiedPanel was rendered with variables that differ from the variables used to fetch fragment user. The fragment was fetched with variables (not fetched), but rendered with variables {}. This can indicate one of two possibilities:

  • The parent set the correct variables in the query - MinifiedPanel.getFragment('user', {...}) - but did not pass the same variables when rendering the component. Be sure to tell the component what variables to use by passing them as props: <MinifiedPanel ... />.
  • You are intentionally passing fake data to this component, in which case ignore this warning.

If I replace it with router.push() the warning is gone and data are fetched.

taion commented

There's literally no difference between the two except for the use of replaceState v pushState in history. Most likely you have some other sort of bug in your app.