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 authored and barmac committed Jan 17, 2019
1 parent d538da4 commit 80362cd
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
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
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 80362cd

Please sign in to comment.