Skip to content

Commit

Permalink
fix(umi-ui): check valid before list project (#3444)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc authored Oct 15, 2019
1 parent 3dc63cc commit c556d0f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/umi-ui/client/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export async function render(oldRender) {
}

window.g_callRemote = callRemote;

// Do render
oldRender();
}
Expand Down
13 changes: 13 additions & 0 deletions packages/umi-ui/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,17 @@ export default class Config {
}
return this.addProjectWithPath(projectPath);
}

checkValid() {
for (const key of Object.keys(this.data.projectsByKey)) {
const { path } = this.data.projectsByKey[key];
// 删除不存在的项目
if (!existsSync(path)) {
delete this.data.projectsByKey[key];
if (this.data.currentProject === key) {
this.data.currentProject = null;
}
}
}
}
}
1 change: 1 addition & 0 deletions packages/umi-ui/src/UmiUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ export default class UmiUI {
);
break;
case '@@project/list':
this.config.checkValid();
success({
data: this.config.data,
});
Expand Down

0 comments on commit c556d0f

Please sign in to comment.