@@ -76,7 +76,6 @@ function recomputeStates(reducer, committedState, stagedActions, skippedActions)
7676 return computedStates ;
7777}
7878
79-
8079/**
8180 * Lifts the app state reducer into a DevTools state reducer.
8281 */
@@ -88,7 +87,8 @@ function liftReducer(reducer, initialState) {
8887 currentStateIndex : 0 ,
8988 monitorState : {
9089 isVisible : true
91- }
90+ } ,
91+ timestamps : [ Date . now ( ) ]
9292 } ;
9393
9494 /**
@@ -101,7 +101,8 @@ function liftReducer(reducer, initialState) {
101101 skippedActions,
102102 computedStates,
103103 currentStateIndex,
104- monitorState
104+ monitorState,
105+ timestamps
105106 } = liftedState ;
106107
107108 switch ( liftedAction . type ) {
@@ -110,17 +111,20 @@ function liftReducer(reducer, initialState) {
110111 stagedActions = [ INIT_ACTION ] ;
111112 skippedActions = { } ;
112113 currentStateIndex = 0 ;
114+ timestamps = [ liftedAction . timestamp ] ;
113115 break ;
114116 case ActionTypes . COMMIT :
115117 committedState = computedStates [ currentStateIndex ] . state ;
116118 stagedActions = [ INIT_ACTION ] ;
117119 skippedActions = { } ;
118120 currentStateIndex = 0 ;
121+ timestamps = [ liftedAction . timestamp ] ;
119122 break ;
120123 case ActionTypes . ROLLBACK :
121124 stagedActions = [ INIT_ACTION ] ;
122125 skippedActions = { } ;
123126 currentStateIndex = 0 ;
127+ timestamps = [ liftedAction . timestamp ] ;
124128 break ;
125129 case ActionTypes . TOGGLE_ACTION :
126130 skippedActions = toggle ( skippedActions , liftedAction . index ) ;
@@ -130,6 +134,7 @@ function liftReducer(reducer, initialState) {
130134 break ;
131135 case ActionTypes . SWEEP :
132136 stagedActions = stagedActions . filter ( ( _ , i ) => ! skippedActions [ i ] ) ;
137+ timestamps = timestamps . filter ( ( _ , i ) => ! skippedActions [ i ] ) ;
133138 skippedActions = { } ;
134139 currentStateIndex = Math . min ( currentStateIndex , stagedActions . length - 1 ) ;
135140 break ;
@@ -138,6 +143,7 @@ function liftReducer(reducer, initialState) {
138143 currentStateIndex ++ ;
139144 }
140145 stagedActions = [ ...stagedActions , liftedAction . action ] ;
146+ timestamps = [ ...timestamps , liftedAction . timestamp ] ;
141147 break ;
142148 case ActionTypes . SET_MONITOR_STATE :
143149 monitorState = liftedAction . monitorState ;
@@ -165,7 +171,8 @@ function liftReducer(reducer, initialState) {
165171 skippedActions,
166172 computedStates,
167173 currentStateIndex,
168- monitorState
174+ monitorState,
175+ timestamps
169176 } ;
170177 } ;
171178}
@@ -174,7 +181,11 @@ function liftReducer(reducer, initialState) {
174181 * Lifts an app action to a DevTools action.
175182 */
176183function liftAction ( action ) {
177- const liftedAction = { type : ActionTypes . PERFORM_ACTION , action } ;
184+ const liftedAction = {
185+ type : ActionTypes . PERFORM_ACTION ,
186+ action,
187+ timestamp : Date . now ( )
188+ } ;
178189 return liftedAction ;
179190}
180191
@@ -215,13 +226,13 @@ function unliftStore(liftedStore, reducer) {
215226 */
216227export const ActionCreators = {
217228 reset ( ) {
218- return { type : ActionTypes . RESET } ;
229+ return { type : ActionTypes . RESET , timestamp : Date . now ( ) } ;
219230 } ,
220231 rollback ( ) {
221- return { type : ActionTypes . ROLLBACK } ;
232+ return { type : ActionTypes . ROLLBACK , timestamp : Date . now ( ) } ;
222233 } ,
223234 commit ( ) {
224- return { type : ActionTypes . COMMIT } ;
235+ return { type : ActionTypes . COMMIT , timestamp : Date . now ( ) } ;
225236 } ,
226237 sweep ( ) {
227238 return { type : ActionTypes . SWEEP } ;
0 commit comments