-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fastboot compatibility #56
Conversation
I'm willing to accept this, but I wonder if @tomdale has better recommended approaches. Looking up the service seems heavier than a |
@runspired The FastBoot service and
|
You can check out the work we've been doing with Ember Simple Auth to see how we are handling it over there. |
@arjansingh I see. At a minimum I'd like to know why the service is being looked up in such a non-ember way. |
Specifically: Why something like this?
Instead of this?
|
Because if an application is not requiring |
@arjansingh thanks! This all makes much more sense now. @anthonybalmeo thanks again for doing the legwork here :) |
Believe me. I wish there was a cleaner way too. 😀 I'll let you know when I find one. |
@runspired thanks! |
Many months ago this was not an issue, and injecting a service does not actually call init() so wondering if there is more context anyone could provide (at the least for the knowledge sharing sake). This seems superfluous I guess IMO... Fastboot doesn't have an event dispatcher and it seems odd it would invoke such a code path. Anyone care to explain more if they have time. Likely a misunderstanding on my part so figured I'd ask the obvious. |
@@ -29,6 +37,8 @@ export default Mixin.create({ | |||
}, | |||
|
|||
__setupRecognizers: on('didInsertElement', function() { | |||
if (this.get('__fastboot.isFastBoot')) { return; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps my question is related to this code path. Fastboot will not call this hook so... Curious I am if someone had an error that provoked this PR.
Thanks for hearing me out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eriktrom I was helping @anthonybalmeo on this. You're right, didInsertElement
should not be called in FastBoot, but this code was somehow getting run, hence the guard. Maybe it is indirectly called by init
like you suggest below. We're looking into that and will let you know.
Can you create a release for this? Thanks! |
@anthonybalmeo - window.Hammer is only invoked here when rendering in fastboot (within Hammer.js should not exist though anyway b/c of this guard I put in a while back within the build - https://github.com/runspired/ember-gestures/blob/31ce7c74bff5eadbfdfa7bcf4c4539ae85e310fa/index.js#L17-L24 To explain, ember-network is a good example of this sort of branching - https://github.com/tomdale/ember-network/blob/2826247c5dd2bb2537497af5ad7fecbd3feba6c9/index.js#L49-L55 This way of handling fastboot shouldn't be a problem given ember-hammertime handles the ast transform of the rendered html from the server thus still providing 'fastclick' support before the app is replaced by the browser rendered version. (worth mentioning here that ember-hammertime should be in fastboot and browser build, if the ember-network inspired 'at build time' option becomes appealing to ya'll) anyway, my 2 cents - figured i'd mention this cause I saw it on my phone yesterday but didn't have the time to explain what I was trying to invoke with the questions i asked @anthonybalmeo I am curious what you've found in practice and what stack trace you got, that'll confirm or deny my suspicions (and/or craziness LOL) k, cheers folks, let me know if I can help further |
@eriktrom I think modifying the build tree approach would definitely be the cleanest. I don't know enough about ember-gesture's dependency structure to do that would probably let you remove all of the in code checks from this PR. |
On |
@anthonybalmeo - lets move this to #57 - gave the cleanup a shot |
Adding Fastboot compatibility.