@@ -26,8 +26,9 @@ import { getChartSize, getListSize } from "./utils/dimensions";
2626import Headstart from "./components/Headstart" ;
2727import { sanitizeInputData } from "./utils/data" ;
2828import { createAnimationCallback } from "./utils/eventhandlers" ;
29- import { removeQueryParams , handleReduxAction } from "./utils/url" ;
29+ import { removeQueryParams , handleUrlAction } from "./utils/url" ;
3030import debounce from "./utils/debounce" ;
31+ import { handleTitleAction } from "./utils/title" ;
3132
3233/**
3334 * Class to sit between the "old" mediator and the
@@ -427,7 +428,7 @@ function createQueryParameterMiddleware() {
427428 return function ( ) {
428429 return ( next ) => ( action ) => {
429430 if ( ! action . canceled && ! action . isFromBackButton ) {
430- handleReduxAction ( action ) ;
431+ handleUrlAction ( action ) ;
431432 }
432433
433434 return next ( action ) ;
@@ -436,21 +437,13 @@ function createQueryParameterMiddleware() {
436437}
437438
438439function createPageTitleMiddleware ( itm ) {
439- return function ( ) {
440+ return function ( { getState } ) {
440441 return ( next ) => ( action ) => {
441- if (
442- action . type === "ZOOM_IN" &&
443- ! action . canceled &&
444- action . selectedAreaData
445- ) {
446- document . title = `${ action . selectedAreaData . title } | ${ itm . originalTitle } ` ;
447- }
448- if ( action . type === "ZOOM_OUT" && ! action . canceled ) {
449- document . title = itm . originalTitle ;
442+ if ( ! action . canceled && ! action . isFromBackButton ) {
443+ const state = getState ( ) ;
444+ handleTitleAction ( action , itm . originalTitle , state ) ;
450445 }
451446
452- // TODO select paper / deselect paper ?
453-
454447 return next ( action ) ;
455448 } ;
456449 } ;
0 commit comments