Skip to content

Commit

Permalink
Merge pull request #217 from umijs/fix/umi-plugin-dva-endless-loop
Browse files Browse the repository at this point in the history
fix(umi-plugin-dva): endless loop if route if outside of the pages dir
  • Loading branch information
sorrycc authored Mar 15, 2018
2 parents 5a756a1 + 8d1d069 commit f3d58ea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/umi-plugin-dva/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export default function(api) {
);
}

function isSrcPath(path) {
return (
winPath(endWithSlash(path)) === winPath(endWithSlash(paths.absSrcPath))
);
}

function getGlobalModels() {
let models = getModel(paths.absSrcPath);
if (!isProduction) {
Expand All @@ -54,7 +60,7 @@ export default function(api) {

function getPageModels(cwd) {
let models = [];
while (!isPagesPath(cwd)) {
while (!isPagesPath(cwd) && !isSrcPath(cwd) && cwd !== '/') {
models = models.concat(getModel(cwd));
cwd = dirname(cwd);
}
Expand Down

0 comments on commit f3d58ea

Please sign in to comment.