Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: handle opening files with less pages
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed May 24, 2018
1 parent 0881299 commit fdb44c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/electron/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Sender.receive(message => {
case ServerMessageType.OpenFileResponse: {
const newProject = Project.from(message.payload.contents);
newProject.setPath(message.payload.path);

store.setProject(newProject);
store.setActiveView(Types.AlvaView.PageDetail);
break;
Expand Down
7 changes: 7 additions & 0 deletions src/store/view-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,13 @@ export class ViewStore {

public setProject(project: Project): void {
this.currentProject = project;
const pages = this.currentProject.getPages();

if (pages.length > 0) {
this.setActivePageByIndex(0);
} else {
this.unsetActivePage();
}
}

/**
Expand Down

0 comments on commit fdb44c2

Please sign in to comment.