Stopping Ember.js Controller
My question is very basic on one hand but on the other hand the general
situation is more complex, plus I cannot really get any working sample.
I'm developing/maintaing a web-application which is currently in
transition from GWT code base into Ember.js.
Most of the newer code already relies on Ember.js and I think it's really
awesome. The problem is we cannot use Ember Router as all the request are
being handled by the GWT. In order to enabled the application run in this
unusual configuration we have special JavaScript files that create our
Ember main objects (Controllers & Models) for us.
As you can imagine navigation between tabs is cumbersome and is handled by
GWT who creates Ember objects when needed. We are in transit toward a
brave new world Ember Router and all.
But in the meantime, this is the problem I'm facing right now.
The user clicks a link which opens a page that contains some Ember based
table. The data is retrieved form the server using some Ajax code. Upon
success it spawns a forEach loop which tries to pushObject all the
received date into our Ember based components.
My problem happens when the user quickly switches between tabs. In this
case the first list of object has not finished rendering yet and suddenly
there's a new set of objects to handle. This causes Ember to throw errors
like: "Uncaught Error: Cannot perform operations on a Metamorph that is
not in the DOM. "
and
"Uncaught NotFoundError: An attempt was made to reference a Node in a
context where it does not exist."
Is it possible to prevent the loop from trying to render? I've tried
checking if the controller in question is already inDOM and it is, is
there a way to notify Ember this object is no longer valid?
Sorry for a lengthy question and lack of running sample.
No comments:
Post a Comment