Skip to content

Commit 3d88552

Browse files
rueckstiesskangas
authored andcommitted
INT-1290 fix collection selection after instance reload
1 parent b137470 commit 3d88552

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/app/home/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var _ = require('lodash');
1212
var debug = require('debug')('mongodb-compass:home');
1313
var jade = require('jade');
1414
var path = require('path');
15+
var toNS = require('mongodb-ns');
1516

1617
var indexTemplate = jade.compileFile(path.resolve(__dirname, 'index.jade'));
1718

@@ -133,6 +134,13 @@ var HomeView = View.extend({
133134
document.title = title;
134135
},
135136
showCollection: function(model) {
137+
// get the equivalent collection model that's nested in the
138+
// db/collection hierarchy under app.instance.databases[].collections[]
139+
var ns = toNS(model.getId());
140+
model = app.instance
141+
.databases.get(ns.database)
142+
.collections.get(ns.ns);
143+
136144
var collection = app.instance.collections;
137145
if (!collection.select(model)) {
138146
return debug('already selected %s', model);

src/app/home/instance-properties.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var View = require('ampersand-view');
22
var app = require('ampersand-app');
3-
// var debug = require('debug')('mongodb-compass:sidebar:instace-properties');
3+
// var debug = require('debug')('mongodb-compass:home:instance-properties');
44
var _ = require('lodash');
55
var jade = require('jade');
66
var path = require('path');

0 commit comments

Comments
 (0)