Comments (2)
Can you elaborate on why this wouldn't be solved by a follow on read?
Are you trying to mutate a non untangled server?
from untangled-client.
Copied from @awkay on slack:
The Om model is that mutations can remap tempids. There is no return value. The reason for this is that there is no query, so there is no way to merge that result into your database. Thus, the follow-on remote read.
This is a common misconception about the overall model.
The model is that the mutation is abstract. The UI and Server have no coupling. The server has no idea what you're showing, and the client has little idea (other than advertised keywords on the mutation...which isn't documented well, but is part of Om) what the server is really doing.
So, in order to fix this gap, the client specifically asks for reads on the data that it knows it is displaying that could have changed on the server.
E.g.
Say you have a mutationadd-friend
. The server could return all manner of information: the new friend count, a success code, the list of current friends.
Now you're tempted to make a mutaiton for every possible return value? Or just send it all back?
None of that is nearly as simple as the UI directly saying: do this, and then I need to know this other thing.If you read the Om docs David mentions listing keys on a mutation. These are where you put advisory documentation on your mutation as to what data items the mutation affects, so that a UI programmer can read that (as documentation) and decide what to explicitly query.
I'd recommend documenting the affected keys in whatever way makes sense for your developers, because this is a point of difficulty (and maintenance), though in practical systems it is pretty obvious what things you might want to read because the mutation is an abstraction with general meaning.
E.g. in theadd-friend
case I can guess that my friend count just changed.
It is a subtle shift, and I understand the desire to want a "return value"...but they just don't make sense in the overall model.
(and I'd argue that David is right here...this is a simple/better approach to the problem of UI composition)
from untangled-client.
Related Issues (20)
- Enhancement: Support viewer needs two kinds of compression
- Enhancement: Support viewer needs Facelift HOT 1
- Merging a not-found ident join crashes HOT 1
- Support externally supplied atom with InitialAppState
- Enhancement: Make it possible to have load-data place the load marker in custom app-state locations HOT 3
- Union queries with InitialAppState seem to break normalization with 0.5.8-SNAPSHOT HOT 3
- Enhancement: Support custom transit handlers HOT 1
- Links to untangled tutorial return 404 HOT 3
- Data fetch markers being left after union merge with no data HOT 2
- Merge of nested union's InitialAppState is broken HOT 1
- app state passed to global error callback does not have the `:untangled/server-error` in that app state. HOT 3
- Regression? 0.8.0-SNAPSHOT sweep merge might not be working HOT 1
- Allow custom reconciler options HOT 1
- `split-items-ready-to-load` reorders reads in the outgoing remote transaction HOT 2
- Feature: Ability to chain parsers HOT 1
- Bug: Loading by ident does not use proper merge HOT 1
- Load marker stomps on data if it's a not normalized map HOT 1
- remote same-named mutations in a single tx should be split to separate network requests HOT 1
- Devcards support hot code reload loses state HOT 1
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 untangled-client.