aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/completion.js2
-rw-r--r--src/components/follow.js2
-rw-r--r--src/content/index.js4
-rw-r--r--src/pages/console.js7
-rw-r--r--src/reducers/completion.js2
-rw-r--r--src/reducers/index.js6
6 files changed, 14 insertions, 9 deletions
diff --git a/src/components/completion.js b/src/components/completion.js
index 489061c..d1fdd06 100644
--- a/src/components/completion.js
+++ b/src/components/completion.js
@@ -6,7 +6,7 @@ export default class Completion {
}
update() {
- let state = this.store.getState();
+ let state = this.store.getState().completion;
if (JSON.stringify(this.prevState) === JSON.stringify(state)) {
return;
}
diff --git a/src/components/follow.js b/src/components/follow.js
index 4fe4c58..d2d3902 100644
--- a/src/components/follow.js
+++ b/src/components/follow.js
@@ -44,7 +44,7 @@ export default class FollowComponent {
update() {
let prevState = this.state;
- this.state = this.store.getState();
+ this.state = this.store.getState().follow;
if (!prevState.enabled && this.state.enabled) {
this.create();
} else if (prevState.enabled && !this.state.enabled) {
diff --git a/src/content/index.js b/src/content/index.js
index ea08982..38ad837 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -6,11 +6,11 @@ import * as followActions from '../actions/follow';
import { createStore } from '../store';
import ContentInputComponent from '../components/content-input';
import FollowComponent from '../components/follow';
-import followReducer from '../reducers/follow';
+import reducers from '../reducers';
import operations from '../operations';
import messages from './messages';
-const store = createStore(followReducer);
+const store = createStore(reducers);
const followComponent = new FollowComponent(window.document.body, store);
store.subscribe(() => {
try {
diff --git a/src/pages/console.js b/src/pages/console.js
index 4ce9e47..0e152d3 100644
--- a/src/pages/console.js
+++ b/src/pages/console.js
@@ -2,11 +2,11 @@ import './console.scss';
import messages from '../content/messages';
import CompletionComponent from '../components/completion';
import ConsoleComponent from '../components/console';
-import completionReducer from '../reducers/completion';
+import reducers from '../reducers';
import { createStore } from '../store';
import * as completionActions from '../actions/completion';
-const store = createStore(completionReducer);
+const store = createStore(reducers);
let completionComponent = null;
let consoleComponent = null;
let prevState = {};
@@ -15,14 +15,13 @@ window.addEventListener('load', () => {
let wrapper = document.querySelector('#vimvixen-console-completion');
completionComponent = new CompletionComponent(wrapper, store);
- // TODO use root root store instead of store
consoleComponent = new ConsoleComponent(document.body, store);
});
store.subscribe(() => {
completionComponent.update();
- let state = store.getState();
+ let state = store.getState().completion;
if (state.groupSelection >= 0) {
let item = state.groups[state.groupSelection].items[state.itemSelection];
diff --git a/src/reducers/completion.js b/src/reducers/completion.js
index a8a6444..878aeac 100644
--- a/src/reducers/completion.js
+++ b/src/reducers/completion.js
@@ -63,6 +63,6 @@ export default function reducer(state = defaultState, action = {}) {
});
}
default:
- return defaultState;
+ return state;
}
}
diff --git a/src/reducers/index.js b/src/reducers/index.js
index 9beb81c..db17edf 100644
--- a/src/reducers/index.js
+++ b/src/reducers/index.js
@@ -1,11 +1,15 @@
import inputReducer from '../reducers/input';
import consoleReducer from '../reducers/console';
import settingReducer from '../reducers/setting';
+import followReducer from '../reducers/follow';
+import completionReducer from '../reducers/completion';
const defaultState = {
input: inputReducer(undefined, {}),
console: consoleReducer(undefined, {}),
setting: settingReducer(undefined, {}),
+ follow: followReducer(undefined, {}),
+ completion: completionReducer(undefined, {}),
};
export default function reducer(state = defaultState, action = {}) {
@@ -13,5 +17,7 @@ export default function reducer(state = defaultState, action = {}) {
input: inputReducer(state.input, action),
console: consoleReducer(state.console, action),
setting: settingReducer(state.setting, action),
+ follow: followReducer(state.follow, action),
+ completion: completionReducer(state.completion, action),
});
}