Skip to content

Commit

Permalink
fix(app/client): ensure workspace backwards compatibility
Browse files Browse the repository at this point in the history
Related to #866
Related to #910
  • Loading branch information
philippfromme committed Sep 20, 2018
1 parent 109db06 commit ea228e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/lib/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ function Workspace(config) {
return done(null, defaultConfig);
}

forEach(workspace.files, function(diagram) {
// ensure backwards compatibility
forEach((workspace.files || workspace.tabs), function(diagram) {
try {
var contents = fs.readFileSync(diagram.path, { encoding: 'utf8' });

Expand Down
11 changes: 8 additions & 3 deletions client/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,18 +517,23 @@ export class App extends Component {
onReady();
}

const config = await this.restoreWorkspace();

const {
activeTab,
files,
layout
} = await this.restoreWorkspace();
} = config;

await this.openFiles(files);

if (activeTab === -1) {
// ensure backwards compatibility
const activeTabId = config.activeTabId || activeTab;

if (activeTabId === -1) {
this.selectTab(this.state.tabs[ this.state.tabs.length - 1 ]);
} else {
this.selectTab(this.state.tabs[ activeTab ]);
this.selectTab(this.state.tabs[ activeTabId ]);
}

this.setState({
Expand Down

0 comments on commit ea228e1

Please sign in to comment.