Skip to content

Commit

Permalink
fix(theme): ssr faild for home page
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Nov 3, 2020
1 parent 7cce8ec commit 2191417
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/preset-dumi/src/themes/default/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ export default class Layout extends Component<ILayoutProps & RouteProps> {

// redirect to home page if there has no matched route
if (!state.currentRouteMeta && location.pathname !== rootPath) {
window.location.replace(rootPath);
if (typeof window !== undefined) {
window.location.replace(rootPath);
}

// just to avoid throw error
state.currentRouteMeta = {};
Expand Down

0 comments on commit 2191417

Please sign in to comment.