Comments (12)
I would like to see this as well.
Workaround is to observe the array and take its firstObject once it comes in.
from data.
How about adding a wrapper for findMany that returns a single object without ID, so that you can push it into the view immediately, then hold a reference to it until the ajax callback and populate with the first record returned.
The key issue for me is not having to manage the callbacks (plumbing) in my app logic.
from data.
Is the rationale for this feature a singleton resource in general?
from data.
I think that there are lots of cases where I want to get one instance of a model and I know it's there but I don't know the ID.
For example: in a calendar system I may want to get today
or this month
, I know they exist (and if they don't I will create them server side as part of the request) but I don't know their ID.
And I want to insert the single item into the view, not a collection. Of course there are workarounds, but just not so convenient.
from data.
Makes sense.
from data.
For now, you can use jQuery.ajax
to hit the endpoint and then load
into your store.
from data.
You can also use a fake id, such as 'singleton' and have you adapter handle this case. Judging by #58 this is not something we have explicit plans to support, though a PR to hide the 'singleton' id might be acceptable.
from data.
What's the status of this request? I don't really get it. I'm absolutely in favor of it. In my case, I have a find query App.MyModel.find({q: "test"})
witch always returns only one model (not always the same). Currently I have to use the same workaround as described in Issue #385. A fake ID isn't working, because it's a query. And using jQuery.ajax
is in my opinion totally the wrong approach, because it's a parallel structure and I can't just switch my adapter, if I want to.
from data.
This is also related to #551
from data.
So, wait, @wycats said this makes sense, and this and related issues (#58 #97 #385 #393 #551 possibly others) keep coming up, yet this seems to get rejected out of hand... is there some way to find consensus?
from data.
Chiming in that I find this to be an odd oversight. I just spent a good deal of time trying to hack up a way to load a simple currentUserProfile . . . which is just that, the profile of the current user. It has no idea, just a series of value related to the user returned from the middle layer.
Backbone and other frameworks allow for an singular instance that is just a model and not a collection, I find it odd that this feature keeps getting deferred.
from data.
See #551.
from data.
Related Issues (20)
- bug: typescript error when using computed properties in conditionals HOT 1
- bug: async-to-async relationships may error when using `unloadAll` on both types HOT 12
- Preloading polymorphic relationship breaks on ember-data 5.3 HOT 2
- Feat - Additional Functionality Support in RequestManager for handler for Dynamic Handling beyond 'request' HOT 3
- Broken link in JSON Api ReadMe HOT 1
- cache.rollbackRelationships does not rollback the 2nd time after adding a record and rollback again HOT 3
- Understanding polymorphism HOT 2
- Assertion after saving a new relational record and tried to forget it HOT 4
- [3.28->4.7] `isLoaded` does not recompute if checked before the record has loaded. HOT 6
- Error `Could not find module `@warp-drive/core-types/request` imported from `(require)`` after update to 5.3.1 HOT 15
- ember-data date transform: triggering change on record re-insertion HOT 6
- bug: not tracking changes to empty relationship in 5.3.1+
- Breaks yarn install on Windows HOT 4
- Build broken after update from `5.3.0` to `5.3.3` HOT 3
- Deprecations will fire spuriously under strict ES module builds HOT 4
- Attributes with defaultValue functions not persisting HOT 8
- 🛤️ tracking: The Road to Polaris ✨ HOT 3
- Request can't handle `null` as response HOT 3
- Overridden `Model` methods have incorrect `this` type HOT 1
- Custom model instances’ type is not assignable to `Model` 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 data.