Fix document title syncing
This commit is contained in:
@ -2,14 +2,15 @@
|
|||||||
// () =>
|
// () =>
|
||||||
// (next: (action: Action) => Object) =>
|
// (next: (action: Action) => Object) =>
|
||||||
// titleSage(action: Action) => Object|Void
|
// titleSage(action: Action) => Object|Void
|
||||||
export default (doc) => () => next => {
|
export default ({ doc }) => ({ getState }) => next => {
|
||||||
return function titleSage(action) {
|
return function titleSage(action) {
|
||||||
// get next state
|
// get next state
|
||||||
const result = next(action);
|
const result = next(action);
|
||||||
if (action !== 'updateTitle') {
|
if (action.type !== 'app.updateTitle') {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
const newTitle = result.app.title;
|
const state = getState();
|
||||||
|
const newTitle = state.app.title;
|
||||||
doc.title = newTitle;
|
doc.title = newTitle;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user