React-native: Relay.QL is cached somewhere hidden possibly by react-native packager.

Created on 7 Apr 2016  路  7Comments  路  Source: facebook/react-native

Also created an issue on relay repo since I am not sure if this is a relay or react-native problem: https://github.com/facebook/relay/issues/1028

I am currently using relay together with react-native.
I have found that whenever I make a change to GraphQL schema, there is a hidden cache somewhere that needs to be manually invalidated for the Relay.QL defined for Relay containers.

I have tried these steps to clear cache:

  • rm -rf ios/build
  • "Reset contents and settings" on iOS Simulator
  • Quit all react-native packager processes
  • rm -rf $TMPDIR/react-*

These are not enough and still causes invalid relay query error.
I think that I would have to make some changes to all Relay.QL fragments that require change while running react-native packager to invalidate the hidden caches.
I wish there is a easy way to clear all caches and start from scratch.

I am not sure if this is relay or react-native problem.

Locked

Most helpful comment

Run the packager with --reset-cache.

All 7 comments

I have seen this issue. I usually find myself doing rm -rf $TMPDIR/react-* which invalidates the cache but def. not an ideal solution.

cc @skevy thoughts?

Doing rm -rf $TMPDIR/react-* did not work for me :(

Run the packager with --reset-cache.

Yah, FWIW, rm -rf $TMPDIR/react-* doesn't do anything. As far as I'm aware, the packager doesn't store anything useful there anymore. --reset-cache is what you want.

Will try!

@skevy wow! i always did rm -rf $TMPDIR/react-*with --reset-cache. Never realised rm was not doing anything!

I confirm that running react-native start --reset-cache indeed solves this problem!
Thank you all!

Was this page helpful?
0 / 5 - 0 ratings