Comments (8)
I think the right approach is to keep around all queries that have ever been persisted, until you are really sure there are no old clients out there. So I would suggest taking the output of this tool and adding some large number to every ID.
Perhaps a PR to switch to UUIDs instead of numbers would be good, then people can just insert the IDs as-is.
from persistgraphql.
I think keeping them in a database would be reasonable. Are you planning on supporting a feature like this in Ruby?
from persistgraphql.
Agree with @stubailo. I think persistgraphql should probably allow you to do a "merge with existing" kind of thing where you can crawl an updated codebase but merge it with an existing persisted queries JSON file.
from persistgraphql.
Is that to avoid saving duplicate queries?
Actually, using a hash instead of an ID would probably solve that since you can just insert into your database of queries if the hash doesn't exist.
from persistgraphql.
In my mind, it would just be a convenience thing that allows you to handle multiple client versions rather than something that's meant to reduce the number of queries represented in the map.
from persistgraphql.
I guess I don't think anyone will actually be storing the queries in a JSON file, so if anything a more useful thing would be a function that saves the queries to some kind of storage.
from persistgraphql.
Yeah, I'm definitely interested in building a persisted query system for Ruby servers. I took a crack at it a while back and it left me with these questions:
- How to support outstanding clients? (This also applies to development: if you change the
.graphql
files, your currently-open browser is now stale, and at least for Rails, the only option is to reload the page. C-c-c-combo breaker!) - Is storage in memory enough? I have two questions there: will some users ever have so many queries that storing them in memory is burdensome? And, for Ruby, will we have threadsafety issues? (That can be worked around, but it's something to keep an eye on.)
So, I didn't come up with any answers ... just questions
from persistgraphql.
Oh, I think the server should accept all queries in development mode.
So the answers to your questions IMO are:
- You never delete queries, only add them to a database; in development, the server should accept all queries and there's no need for persisting.
- I think queries should be stored in a database and cached in memory, I can imagine people easily having many thousands of queries since you need to persist a new one every time you change just one field.
Let me know if I can help with a Ruby server addition!
from persistgraphql.
Related Issues (20)
- Maximum call stack error when using cloneDeep in query transformer
- [Idea] replace json property names with ordinals to reduce bandwidth HOT 4
- Must provide a query error when use with graphql-subscription
- Mixing .graphql files with tagged template literals HOT 1
- Server and client sync
- Can it be used with Relay Modern? HOT 2
- can't install on Windows HOT 2
- [BUG] persistgraphql serializes *differently* from apollo client, breaking the whitelist HOT 1
- Register query manually
- Support glob syntax [feature request]
- [BUG] template strings within attributes not parsed correctly
- How should we namespace open source queryTransformers? HOT 7
- Hapi17 Example
- Relax dependency requirements HOT 5
- Does not recognize .gql file extension HOT 1
- Commented out query causes syntax error during javascript extraction
- Queries from both external graphql files and JS extraction aren't output together
- This tool can only generate 1 query when scan a directory that contains multiple ".graphql" files HOT 2
- Add / enable Travis CI
- Support babel compiled AST.
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 persistgraphql.