import { ActionTypes as historyActions } from 'redux-undo' ; import { ActionType , getType } from 'typesafe-actions' ; import * as helperActions from '../actions/bindChannel/helperActions' ; import * as datasetActions from '../actions/datasetActions' ; import * as guideActions from '../actions/guideActions' ; import * as interactionActions from '../actions/interactionActions' ; import * as widgetActions from '../actions/widgetActions' ; import * as markActions from '../actions/markActions' ; import * as pipelineActions from '../actions/pipelineActions' ; import * as scaleActions from '../actions/scaleActions' ; import * as sceneActions from '../actions/sceneActions' ; import * as signalActions from '../actions/signalActions' ; import * as vegaActions from '../actions/vegaActions' ; import { hydrate } from '../ctrl/persist' ; import { VegaReparse , VegaReparseRecord } from '../store/factory/Vega' ; param { boolean } state param { Object } action returns { boolean } export function invalidateVegaReducer ( state , action ) { if ( typeof state === 'undefined' ) { return VegaReparse ( { invalid : false , isParsing : false } ) ; } if ( action . type === getType ( vegaActions . invalidateVega ) ) { return state . set ( 'invalid' , action . payload ) ; } switch ( action . type ) { case getType ( sceneActions . baseCreateScene ) : case getType ( pipelineActions . baseAddPipeline ) : case getType ( signalActions . initSignal ) : case getType ( markActions . baseAddMark ) : case getType ( guideActions . deleteGuide ) : case getType ( markActions . baseDeleteMark ) : case getType ( markActions . setParent ) : case getType ( markActions . updateMarkProperty ) : case getType ( markActions . setMarkVisual ) : case getType ( markActions . disableMarkVisual ) : case getType ( markActions . resetMarkVisual ) : case getType ( markActions . setMarkExtent ) : case getType ( markActions . bindScale ) : case getType ( scaleActions . baseAddScale ) : case getType ( scaleActions . updateScaleProperty ) : case getType ( helperActions . addScaleToGroup ) : case getType ( scaleActions . deleteScale ) : case getType ( guideActions . baseAddGuide ) : case getType ( guideActions . updateGuideProperty ) : case getType ( helperActions . addAxisToGroup ) : case getType ( helperActions . addLegendToGroup ) : case getType ( interactionActions . baseAddInteraction ) : case getType ( interactionActions . setInput ) : case getType ( interactionActions . setSelection ) : case getType ( interactionActions . setSignalPush ) : case getType ( interactionActions . toggleEnableApplicationType ) : case getType ( interactionActions . setApplication ) : case getType ( interactionActions . removeApplication ) : case getType ( interactionActions . deleteInteraction ) : case getType ( widgetActions . baseAddWidget ) : case getType ( widgetActions . setSelection ) : case getType ( widgetActions . setApplication ) : case getType ( widgetActions . removeApplication ) : case getType ( widgetActions . deleteWidget ) : case getType ( datasetActions . sortDataset ) : case getType ( datasetActions . addTransform ) : case getType ( datasetActions . updateTransform ) : case getType ( hydrate ) : case historyActions . UNDO : case historyActions . REDO : case historyActions . JUMP_TO_FUTURE : case historyActions . JUMP_TO_PAST : return state . set ( 'invalid' , true ) ; } if ( action . type === getType ( vegaActions . parseVega ) ) { return state . merge ( { isParsing : action . payload , invalid : false } ) ; } return state ; }