Question

If an user modifies the dynamic segment (object ID) in the URL of an Ember App with Ember Data, what's the best practice to handle these URLs as these might refer to non existing Model entries?

In a minimal example one can observe, that for each call with a non-existent ID (for example http://emberjs.jsbin.com/hurozaju/9#/color/30) there is an empty object added to the local ember data store. This is easily observable by the increasing number of "dots" in the output.

The error-action of App.ColorRoute redirects (as intended) to "colors" in case there is a 404 occurring while fetching the model by ID.

Why is there a "new" Object in the store?

Shouldn't the data be left unmodified?

Is there a chance to prevent the creation of new objects in this case?

Was it helpful?

Solution

I spend some time with this problem and i think this is ember-data beta-7 bug. Please report this issue in github.

OTHER TIPS

here is example code how to work around this issue jsbin. This is tested with data-beta.7 and work and with data-beta.4 not working.

Sorry for not waiting as anounced...

This issue is now reported to ember-data on github.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top