Comments (3)
I've started working on this in a branch and need a place to hold onto some thoughts:
- a single type could have multiple keys that are used together to form a record's ID
- the node query used by refetches should be configurable to allow for specific queries that look up a value.
My current thinking for the API:
config = {
defaultKeys: ['_id'],
types: {
User: {
keys: ['email'],
// not quite sure what to call this
refetch: {
queryField: 'user',
arguments: (user) => {email: user.email}
},
}
}
}
from houdini.
My Vote...
I like the idea of the defaultKeys - not sure of the name... it might be better to call it defaultKeyField: '_id'
as I think the default should only be a single.
And for entity key I would go with keyFields
config = {
defaultKeyField: '_id',
types: {
User: {
keyFields: ['email'],
// not quite sure what to call this
refetch: {
queryField: 'user',
arguments: (user) => {email: user.email}
},
}
}
}
from houdini.
Thanks for the input @lyle! I'm also unsure about the names. I was hoping that "key" implied "keyField" but I guess if a user is coming up to a config file for the first time it might not be totally clear. I'll think on it some more.
Do you have any ideas for what I could use instead of "refetch"? In case it wasn't clear from the example, that object configures the query that the cache uses to support things like paginated fragments. For any object that implements the Node
interface, that object would take the default value:
{
//...
refetch: {
queryField: 'node',
arguments: node => ({ id: node.id })
}
}
edit: I just realized I named the internal function that looks up the keys for a field keyFieldsForType()
so i guess I agree with you subconsciously 🤦
from houdini.
Related Issues (20)
- SvelteKit 2 support HOT 5
- TypeError: Cannot read properties of undefined HOT 2
- Field parameters passed through fragments with arguments are incorrectly masked out
- Use differentiate server and client url. HOT 3
- houdini vite plugin fail with latest sveltekit 2 HOT 5
- TypeError: Cannot read properties of undefined (reading 'setup') HOT 3
- Wrong values after matching child collection HOT 2
- Bump GraphQL dependency to v16
- Houdini for Express Servers HOT 7
- "Maximum call stack size exceeded" when passing fragment arguments to `@include` or `@skip` directive HOT 1
- export type * from causes Unexpected token HOT 3
- Support no-cache fetch policy HOT 1
- Defer query support HOT 1
- Monorepo requires local @sveltejs/kit dependency
- Use GraphQL field descriptions to generate JSDoc comments on `$result` types HOT 3
- Houdini fails to load data on initial query HOT 2
- Support the using keyword (explicit resource management)
- List insert mutation with a `@with` param doesn't update the list
- Houdini-svelte crashes the svelte LSP in vscode
- Memory leak in error path HOT 2
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 houdini.