Comments (8)
Ahh... yes, I apologize greatly for not getting to this before we shipped yesterday. I'll try to get it fixed as soon as possible (unless someone beats me to it with a PR).
from relay.
@yungsters What's the ideal behavior? Would it be sufficient to just find the route.queries
that includes a particular fragment and keep everything else the same?
from relay.
@devknoll Yes, I think that is the ideal behavior. Unfortunately, there is no good way of figuring out which queries in route.queries
includes X
when all we have to work with is ${Component.getFragment(X)}
.
from relay.
Ok, two ideas.
- Super hacky: Run
route.queries[y]
with a mock component to find the fragment names it's looking for. Maybe parse the result to grab the type and make sure it matches on the component too. - A little better: Modify the babel plugin to just stick the possible
X
s as metadata on aroute.queries[y]
Does one of these sound like an approach you'd take?
from relay.
Whoah, idea 1 is super hacky, but I like the way you think. ;)
Another more involved possibility is that we do something like what we did with RelayMutation#getName
:
static queries = {
user: () => Relay.QL`query { user(id: $userID) }`
};
The more I think about it, there really is no semantic value to the keys in queries
. What if we got rid of ${Component.getFragment(X)}
all together and made it clearer that the query name must match your component's fragment name?
I'm also curious what @josephsavona thinks about this.
from relay.
What if we got rid of
${Component.getFragment(X)}
all together and made it clearer that the query name must match your component's fragment name?
I like this idea a lot. I like that it makes it more consistent with mutations and gets rid of the (seemingly arbitrary) Component
argument, while making it clearer that the query
name means something.
In either case, is there a reason we couldn't also just throw an invariant in there to make sure that that every fragment matches a route query? Maybe it'll save some other folks some time ;-)
from relay.
What if we got rid of ${Component.getFragment(X)} all together and made it clearer that the query name must match your component's fragment name?
Yes. We should do that, and also implement @devknoll's idea - root component fragments are automatically added whenever the route key matches the component key, and it's a warning/error if either one has a key that the other is missing.
from relay.
Solved by #181
from relay.
Related Issues (20)
- optional field in array is generated as not undefined but nullable
- TS2786: 'RelayEnvironmentProvider' cannot be used as a JSX component. HOT 1
- Support for React Server Components HOT 9
- [relay-lsp] Add a refactor to turn global variable into explicit fragment argument HOT 1
- babel eagerEsModules, ESM Modules, and missing file extensions
- Async RecordSource methods mentioned in docs but don't seem to exist
- Client schema interface extension are not taken into account by the compiler
- relay-runtime 15.0.0 ConnectionHandler.getConnection() is undefined HOT 2
- Server Exception in Tutorial Newsfeed Example HOT 1
- Code examples on website are hard to read in dark mode
- eslint-plugin-relay README should say that the source of truth is this repo HOT 1
- Relay compiler fails when using custom scalars [16.2] HOT 3
- Loading data inside of hooks VS loading data outside of hooks?
- Making usePreloadedQuery throw a hard error when the environment changes will break React Router HOT 1
- Why does receiving a null node break the execution of the mutation in @appendNode?
- Errors should not be shared between queries HOT 7
- Fix more
- Bug fixes essential. relay interval ,timestamp threshold & few tweaks needed.
- Relay always removes files in `__generated__` eventhough it has it's artifact directory set to `__genenaretd__/relay`
- Start uniquely naming node default exports in generated code
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.