aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-11-04 22:52:17 +0000
committerGitHub <noreply@github.com>2017-11-04 22:52:17 +0000
commit516a701ebb9403b271288349b10bd906a61feee0 (patch)
tree9fea26233e2efbed9b921199eebf04adaec3cf34
parente1fdba693519d36b4be634908070ec65ca442a42 (diff)
parent387524a407be74c3d52758c2b98ef1f93c4289da (diff)
Merge pull request #129 from ueokande/retry-setting-load
fix plugin load
-rw-r--r--.eslintrc1
-rw-r--r--src/content/components/common/index.js4
-rw-r--r--src/content/reducers/setting.js4
-rw-r--r--test/content/reducers/setting.test.js2
4 files changed, 9 insertions, 2 deletions
diff --git a/.eslintrc b/.eslintrc
index 9820e69..949b5a5 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -35,6 +35,7 @@
"multiline-ternary": "off",
"newline-after-var": "off",
"newline-before-return": "off",
+ "newline-per-chained-call": "off",
"no-bitwise": "off",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-empty-function": "off",
diff --git a/src/content/components/common/index.js b/src/content/components/common/index.js
index 4c2c1df..565632c 100644
--- a/src/content/components/common/index.js
+++ b/src/content/components/common/index.js
@@ -32,6 +32,10 @@ export default class Common {
type: messages.SETTINGS_QUERY,
}).then((settings) => {
this.store.dispatch(settingActions.set(settings));
+ }).catch((e) => {
+ // Sometime sendMessage fails when background script is not ready.
+ console.warn(e);
+ setTimeout(() => this.reloadSettings(), 500);
});
}
}
diff --git a/src/content/reducers/setting.js b/src/content/reducers/setting.js
index 22fac6f..b6f6c58 100644
--- a/src/content/reducers/setting.js
+++ b/src/content/reducers/setting.js
@@ -1,6 +1,8 @@
import actions from 'content/actions';
-const defaultState = {};
+const defaultState = {
+ keymaps: {},
+};
export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
diff --git a/test/content/reducers/setting.test.js b/test/content/reducers/setting.test.js
index 50d1cf0..ef49594 100644
--- a/test/content/reducers/setting.test.js
+++ b/test/content/reducers/setting.test.js
@@ -5,7 +5,7 @@ import settingReducer from 'content/reducers/setting';
describe("content setting reducer", () => {
it('return the initial state', () => {
let state = settingReducer(undefined, {});
- expect(state).to.deep.equal({});
+ expect(state).to.deep.equal({ keymaps: {} });
});
it('return next state for SETTING_SET', () => {