-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide an ember-data "moment" transform #157
Comments
I would be in favor of this being its own addon versus implementing ember-data specific logic in the addon. |
Why? It's just providing a transform, not forcing users to use it. And it's moment.js specific... |
It's ember-data specific, not everyone uses ember-data so not everyone should pay the cost. It might be less of an issue if the builds shake unused modules, but that's not the case today. |
What about just leaving it in the P.S. I also can't wait for tree-shaking. 😄 |
The addon folder still gets bundled with the app, but we could create a blueprint for this so users that want this transform can opt into it with Do you want to spike this PR? |
Humm... another good idea. But I thought the Sure, I'll try to look into it this weekend (family time permitting). |
The addon folder is used for namespacing, to prevent collision with the app namespace. |
So I started to do some digging and found out that there already is an addon for moment transforms. https://github.com/pk4media/ember-cli-moment-transform I'm torn between continuing with blueprints here or pointing folks to the other addon... Thoughts? |
@Panman8201 some issues there, that addon uses the obsolete bower dep of ember-moment uses the npm dep: https://github.com/stefanpenner/ember-moment/blob/master/blueprints/ember-moment/index.js#L11 |
Yeah, I noticed that. There is an open PR to fix it though, but no action from the repo owner. (sad) |
Lets just go with the blueprint approach, it makes the most sense and it doesn't look like that project is actively managed anyway. |
Any progress here @Panman8201? I'll likely pick it up soon if you haven't started. |
Im actually -1 on this, not because it isn't a cool feature. But because when this is done, it is almost always a hefty performance issue in apps. Moment is just not terribly quick, and people tend to load lots of ember-data models. Often times resulting in transforms that aren't even used, rather making these transforms HTMLBars helpers is usually the right balance to address the perf isuse. |
I didn't consider the performance impact. But I can imagine a scenario where perf is actually worse if each time you need to act on the date attr you need to convert the date into a moment object, I can think this throwing off the perf trade off in the other direction. I guess the real question is weather transforms happen lazily when accessing attrs or up front (I don't know, but I'd guess during serialization/deserialization). |
It could be used in places where
DS.attr('data')
is currently used. Ex:DS.attr('moment')
The text was updated successfully, but these errors were encountered: