Comments (6)
I would definitely love to see this.
from marty.
My question would be covered by this--I'm having trouble imagining how Create works.
var userStore = Marty.createStore({
...
receiveUser: function(user) {
this.state.users.push(user);
this.stateChanged();
},
createUser: function(user) {
return this.fetch({
id: 'CREATE_USER',
locally: function() {
return this.state.users[id]; // We don't know id
},
remotely: function() {
return userApi.createUser(user);
}
});
}
...
});
If you don't know id, how can local ever know if the API returned a successful result?
from marty.
+1
from marty.
Yes, this would be hugely helpful. The Todo example is outdated and intentionally avoids using a lot of the more important features of Marty (fetch API, promises, state sources, etc)
from marty.
Just as an FYI there is a chat example (es6 version) which is bit more advanced
from marty.
The problems I faced with a CRUD (most of apps I need to work with have them 😢) are:
- Creating an item (which does not have an id which might be created by db)
- Always query to the server for data on the grids (this is related with #111)
- Adding an item while you have a paginated and sorted grid (do you manage sorting clientside?). If you query to the server without caching it, this won't be a problem.
I haven't found a direct match against those items on the examples. Reading the issues alongside with examples helped me to find my own way to implement a CRUD, though.
from marty.
Related Issues (20)
- Cannot read property '0' of undefined HOT 2
- Does the GitHub fetch library have to be used in HTTP Sources? HOT 3
- Server side fetches do not calculate content-length header HOT 6
- webpack, babel, karma & marty v0.9.17 problem with requiring react HOT 5
- I can't get Marty session storage to persist between tabs or Marty localStorage to work at all! HOT 8
- Running headless tests with PhantomJS as a 'browser' fails HOT 2
- Return error in locally HOT 5
- Optionally require `es6-promise` and `isomorphic-fetch` HOT 2
- not properly escaping "</script>" in app state dehydration HOT 2
- test-utils component specs throw on undefined `document` element HOT 10
- Performance Implications? HOT 2
- React.createElement called on each store change
- Consider reversing order in this.handlers HOT 4
- Application.renderToString performance HOT 5
- Application.RenderToString hangs when fetch result returns the value false. HOT 1
- no-iisue HOT 1
- Fetch state in a container based on the result of another fetch HOT 1
- Support React 0.14.0 HOT 6
- Update Docs HOT 2
- How awesome this project has been! 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 marty.