From 027095d621e4b6ae0db85c3cc04a18da81268e3a Mon Sep 17 00:00:00 2001 From: Choko Date: Fri, 9 Aug 2019 16:18:10 +0900 Subject: [PATCH] Fix URLs redirect to root. (#440) * Fix URLs redirect to root. * Not just path * Only use window when available to support prerendering. * Fix window check --- cafe-map/client/web/package.json | 2 +- common/web/base-web/package.json | 2 +- common/web/base-web/src/state/reducers.ts | 4 +++- eggworld/client/web/package.json | 2 +- package.json | 2 +- yarn.lock | 3 ++- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cafe-map/client/web/package.json b/cafe-map/client/web/package.json index 17a7797be..1b2f16eee 100644 --- a/cafe-map/client/web/package.json +++ b/cafe-map/client/web/package.json @@ -12,7 +12,7 @@ } }, "dependencies": { - "@curiostack/base-web": "0.0.44", + "@curiostack/base-web": "0.0.48", "@curiostack/cafemap-api": "1.0.0", "@material-ui/core": "4.2.1", "@material-ui/icons": "4.2.1", diff --git a/common/web/base-web/package.json b/common/web/base-web/package.json index b40cda8a1..c9ecfba1d 100644 --- a/common/web/base-web/package.json +++ b/common/web/base-web/package.json @@ -49,6 +49,7 @@ "@storybook/addon-options": "5.1.9", "@storybook/addon-viewport": "5.1.9", "@storybook/react": "5.1.9", + "@types/enzyme": "3.10.3", "@types/history": "4.7.2", "@types/intl": "1.2.0", "@types/jest": "24.0.15", @@ -137,7 +138,6 @@ "devDependencies": { "@types/compression-webpack-plugin": "2.0.1", "@types/copy-webpack-plugin": "5.0.0", - "@types/enzyme": "3.10.3", "@types/enzyme-adapter-react-16": "1.0.5", "@types/eslint": "4.16.6", "@types/fontfaceobserver": "0.0.6", diff --git a/common/web/base-web/src/state/reducers.ts b/common/web/base-web/src/state/reducers.ts index 6dd87d676..7413a0f7d 100644 --- a/common/web/base-web/src/state/reducers.ts +++ b/common/web/base-web/src/state/reducers.ts @@ -33,7 +33,9 @@ import { InjectableStore } from './store'; export interface RouterStateRecord extends Record, RouterState {} export const routeInitialState: RouterStateRecord = Record({ - location: createLocation(''), + location: createLocation( + typeof window !== 'undefined' ? window.location : '', + ), action: 'POP', })(); diff --git a/eggworld/client/web/package.json b/eggworld/client/web/package.json index 1d689e641..02697d08e 100644 --- a/eggworld/client/web/package.json +++ b/eggworld/client/web/package.json @@ -17,7 +17,7 @@ } }, "dependencies": { - "@curiostack/base-web": "0.0.44", + "@curiostack/base-web": "0.0.48", "@curiostack/eggworld-api": "1.0.0", "howler": "2.1.2", "konva": "3.3.2", diff --git a/package.json b/package.json index 60bee0e00..3b1e67706 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@babel/runtime-corejs2": "7.5.5", "@babel/runtime-corejs3": "7.5.5", "@curiostack/base-node-dev": "0.0.16", - "@curiostack/base-web": "0.0.47", + "@curiostack/base-web": "0.0.48", "@curiostack/eslint-config-web": "0.0.2", "@gfx/zopfli": "1.0.14", "@hugmanrique/react-markdown-loader": "0.0.2", diff --git a/yarn.lock b/yarn.lock index 900ac9943..3b5b69206 100644 --- a/yarn.lock +++ b/yarn.lock @@ -886,7 +886,7 @@ typescript "3.5.3" "@curiostack/base-web@0.0.44": - version "0.0.47" + version "0.0.48" dependencies: "@babel/core" "7.5.5" "@babel/plugin-proposal-async-generator-functions" "7.2.0" @@ -912,6 +912,7 @@ "@storybook/addon-options" "5.1.9" "@storybook/addon-viewport" "5.1.9" "@storybook/react" "5.1.9" + "@types/enzyme" "3.10.3" "@types/history" "4.7.2" "@types/intl" "1.2.0" "@types/jest" "24.0.15"