Relay: Document RelayFeatureFlags

Created on 14 Jul 2020  Â·  5Comments  Â·  Source: facebook/relay

https://github.com/facebook/relay/releases/tag/v10.0.0

Precise type refinement: gated by RelayFeatureFlags.ENABLE_PRECISE_TYPE_REFINEMENT. With this feature enabled Relay more accurately models GraphQL semantics around inline fragments and fragment spreads which have a different type than their parent selection. This helps Relay to more accurately determine if a query can be fulfilled from the cache (ie with the ‘store-or-network’ fetch policy) and also more accurately determine if data is missing and that a component should suspend. Generally speaking, the change is observable as fewer false positives where Relay thinks data is “missing” when it isn’t. This feature will be enabled by default in a subsequent release; we recommend enabling it now.

How do I enable the suggested feature flag? I am unable to locate any official documented reference to RelayFeatureFlags.

Most helpful comment

require('relay-runtime).RelayFeatureFlags.ENABLE_PRECISE_TYPE_REFINEMENT = true

in your app entrypoint

All 5 comments

require('relay-runtime).RelayFeatureFlags.ENABLE_PRECISE_TYPE_REFINEMENT = true

in your app entrypoint

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@sibelius Any ideas on how to enable them for relay-compiler?

You could use patch package, or modify the flag and call the compiler directly in another cli

You gotta add

require('relay-runtime').RelayFeatureFlags.ENABLE_VARIABLE_CONNECTION_KEY = true

to node_modules/relay-compiler/bin/relay-compiler.

as @sibelius mentioned, patch-package is the right tool for this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MartinDawson picture MartinDawson  Â·  3Comments

brad-decker picture brad-decker  Â·  3Comments

derekdowling picture derekdowling  Â·  3Comments

amccloud picture amccloud  Â·  3Comments

staylor picture staylor  Â·  3Comments