Comments (4)
@thenikso Since so many things might change when you log in, we currently recommend just doing a classical page refresh to clear all data. In the future a something like #233 might be useful.
from relay.
Great Question! I think you got the gist of the idea.
The mutation configs we have right now serves two main purposes:
- Tells us how to handle the different mutation fields
- Helps us figure out what fields need to be refetched with the mutation based on what we have stored for a particular node so far.
Reason number 2 is the one I want to focus more on. When a completely new node is added, there is no way for Relay have stored any fields for that new node so far.
If the new node is going to be a field referenced another node (ex. updating a User’scurrent_status
), we can use that node (the User node in this case) to figure out what fields we’ll need to fetch with the mutation as part of aFIELD_CHANGE
mutation config.
If a new node is going to be referenced from a connection (ex. adding a comment in a connection of comments), we can look at the fields under edges that has been fetched for that connection (comments connection) to figure out the fields we would need for this new node as part of aRANGE_ADD
mutation config.
If the new node is not referenced by another node, it is unlikely for the current view to need any data on the new node. However, we have seen people do a route transition after a new node is created. Even though no fields are needed to update the current view, it’s possible to useREQUIRED_CHILDREN
to always fetch any additional fields (like the new node'sid
) so that it could be used during anonSuccess
mutation callback.
from relay.
Thanks for the great details!
from relay.
I dig this. however I'm wondering how would one go to handle something like a "signup" flow; where the viewer
(ie: a query root type) will go from, let's say, an empty object to an actual user.
At this point I'm thinking that a route change or reload would make sense but is there another way? I guess one would want to have something like #233 in the future?
from relay.
Related Issues (20)
- Can I set value of `fetchTime` manually?
- "@graphql-codegen/gql-tag-operations-preset" causing relay-compiler not finding config file
- Missing type definition in assignable fragment generated file in Typescript HOT 6
- Schema extensions are ignored on MacOS, but not on Linux HOT 6
- Relay compiler - No operation text / No operation provided
- loadNext set params to null that not include pagination-fragment HOT 3
- Type-safe updaters: non-assignability of unions HOT 1
- Flow type PreloadedQuery is missing from 16.1.0 release HOT 2
- Integration with google/oss-fuzz for continuous fuzzing HOT 6
- Cargo doc fails to generate documentation HOT 5
- Non meaningful error and application break when declaring a `GraphQLTaggedNode` from `react-relay` HOT 2
- Relay Compiler outputted file links - bad format for VSCode HOT 8
- graphql-syntax: Parser crash `graphql_syntax::parse_document_with_features` HOT 2
- Publish Relay vscode extension v2.1.0 HOT 9
- graphql-syntax: Parser crash parse_document_with_features (internal error: entered unreachable code)
- [lsp] Find field references not always working HOT 2
- graphql-syntax: Parser crash parse_document_with_features (assertion failed: start <= end)
- How to create environment factory HOT 4
- optimisticUpdater has invalid signature
- optional field in array is generated as not undefined but nullable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relay.