Skip to content

Commit cc14337

Browse files
committed
Use replaceWith to transition from missing crate
When visiting a crate that doesn't exist the application uses `transitionTo` to change the route to the index route. This allows the user to navigate back to the same missing crate route which breaks the browsers back button. * Replace `transitionTo` with `replaceWith` to avoid adding history entry. rust-lang#141
1 parent 1518e2f commit cc14337

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/routes/crate.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ export default Ember.Route.extend({
1010
version = parts[1];
1111
}
1212
var self = this;
13-
var a = Ember.RSVP.hash({
13+
return Ember.RSVP.hash({
1414
crate: this.store.find('crate', crate_id).catch(function(e) {
1515
if (e.status === 404) {
1616
self.controllerFor('application').set('nextFlashError',
1717
'No crate named: ' + params.crate_id);
18-
return self.transitionTo('index');
18+
return self.replaceWith('index');
1919
}
2020
}),
2121
version: version,
2222
});
23-
return a;
2423
},
2524

2625
serialize: function(model) {

0 commit comments

Comments
 (0)