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