mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-04-25 18:53:44 +03:00
25 lines
668 B
JavaScript
25 lines
668 B
JavaScript
import { UPDATE_SCROLL_TOP, START_CONSECUTIVE_TOGGLE } from './actions';
|
|
|
|
function initialScrollTop(props, state = 0, action) {
|
|
if (!props.preserveScrollTop) {
|
|
return 0;
|
|
}
|
|
|
|
return action.type === UPDATE_SCROLL_TOP ? action.scrollTop : state;
|
|
}
|
|
|
|
function startConsecutiveToggle(props, state, action) {
|
|
return action.type === START_CONSECUTIVE_TOGGLE ? action.id : state;
|
|
}
|
|
|
|
export default function reducer(props, state = {}, action) {
|
|
return {
|
|
initialScrollTop: initialScrollTop(props, state.initialScrollTop, action),
|
|
consecutiveToggleStartId: startConsecutiveToggle(
|
|
props,
|
|
state.consecutiveToggleStartId,
|
|
action
|
|
),
|
|
};
|
|
}
|