MCPcopy Index your code
hub / github.com/plotly/dash / recordHistory

Function recordHistory

dash/dash-renderer/src/reducers/reducer.js:115–146  ·  view source on GitHub ↗
(reducer)

Source from the content-addressed store, hash-verified

113}
114
115function recordHistory(reducer) {
116 return function (state, action) {
117 // Record initial state
118 const {type, payload} = action;
119 if (type === 'ON_PROP_CHANGE') {
120 // history records all prop changes that are inputs.
121 const historyEntry = getInputHistoryState(payload, state, true);
122 if (historyEntry && !isEmpty(historyEntry.props)) {
123 state.history.present = historyEntry;
124 }
125 }
126
127 const nextState = reducer(state, action);
128
129 if (type === 'ON_PROP_CHANGE' && payload.source !== 'response') {
130 /*
131 * if the prop change is an input, then
132 * record it so that it can be played back
133 */
134 const historyEntry = getInputHistoryState(payload, nextState);
135 if (historyEntry && !isEmpty(historyEntry.props)) {
136 nextState.history = {
137 past: [...nextState.history.past, state.history.present],
138 present: historyEntry,
139 future: []
140 };
141 }
142 }
143
144 return nextState;
145 };
146}
147
148function reloaderReducer(reducer) {
149 return function (state, action) {

Callers 1

createReducerFunction · 0.85

Calls 2

getInputHistoryStateFunction · 0.85
isEmptyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…