so we checked the performance of server side rendering before launch. > It performed well after a patch on Relay (because of a memory leak in the server side) Rendering
initialVariables: { size: null, }, fragments: { profile: () => Relay.QL` fragment on Profile { coverImage(size: $size) } `, }, }); > In the classic version queries and containers are distant from the real GraphQL queries syntax/mode
{ profile: graphql` @argumentDefinitions(size: { type: "String!", defaultValue: "100x100" }) fragment ProfileHeader_profile on Profile { coverImage(size: $size) } `, }); > In the modern version queries became Static and similar to the GraphQL syntax
update it in the Relay Store. The field is available to any component using the type as any other field extend type AlertItem { createdByModal: Boolean } commitLocalUpdate(relayEnv, proxy => { const itemRecord = proxy.get(itemDataID); itemRecord.setValue(true, 'createdByModal'); });
if you request a field in ComponentA, ComponentB won't request it again. > In Relay modern you need to create an instance of the cache. The queryId (name of the query) use to be the key of the record fragment ComponentA_profile on Profile { me { fullname } } fragment ComponentB_profile on Profile { me { fullname } }
has it but also provide a updater that exposes the store. It's powerful because with the Store instance you can do anything from update a field to create a new edge/field. Mutation updater
merge the fields and generate code for the runtime. It does the hard work and let the runtime only with the cheap work - Generates runtime code - Hard work
shared code (anti-pattern, I know, but it's temporary) in order to allow it to be used by projects using classic and modern Relay versions ./classicFragment.js ./modernFragment.js Backward compatibility
compiler lookup in order to allow it to generate the code ./node_modules/.bin/relay-compiler --src . \ --schema ./path-to-schema.json \ --include 'src/**' 'node_modules/my-lib/**' \ --exclude '**/__generated__/**' 'node_modules/my-lib/node_modules/**' \ --extensions js \ "$@" # allow to receive parameters