GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( c335e5...c6cb10 )
by Benjamin
01:46
created

grid.js ➔ gridState   C

Complexity

Conditions 8
Paths 7

Size

Total Lines 49

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 8
c 2
b 0
f 1
nc 7
dl 0
loc 49
rs 6.1403
nop 2
1
import { fromJS } from 'immutable';
2
3
import {
4
    SET_COLUMNS,
5
    RESIZE_COLUMNS,
6
    SET_SORT_DIRECTION,
7
    HIDE_HEADER
8
} from './../../constants/ActionTypes';
9
10
import
11
    localStorageManager
12
from './../../components/core/LocalStorageManager';
13
14
import { generateLastUpdate } from './../../util/lastUpdate';
15
16
const initialState = fromJS({ lastUpdate: generateLastUpdate() });
0 ignored issues
show
Unused Code introduced by
The constant initialState seems to be never used. Consider removing it.
Loading history...
17
18
const debouncedColumnSetter = localStorageManager.debouncedSetStateItem();
19
20
export default function gridState(state = initialState, action) {
21
22
    switch (action.type) {
23
24
    case HIDE_HEADER:
25
        return state.mergeIn([action.stateKey], fromJS({
26
            headerHidden: action.headerHidden,
27
            lastUpdate: generateLastUpdate()
28
        }));
29
30
    case SET_COLUMNS:
31
32
        if (action.stateful) {
33
            setColumnsInStorage({
34
                stateKey: action.stateKey,
35
                columns: action.columns
36
            });
37
        }
38
39
        return state.mergeIn([action.stateKey], fromJS({
40
            columns: action.columns,
41
            lastUpdate: generateLastUpdate()
42
        }));
43
44
    case SET_SORT_DIRECTION:
45
        return state.mergeIn([action.stateKey], fromJS({
46
            columns: action.columns,
47
            lastUpdate: generateLastUpdate()
48
        }));
49
50
    case RESIZE_COLUMNS:
51
52
        if (action.stateful) {
53
            setColumnsInStorage({
54
                stateKey: action.stateKey,
55
                columns: action.columns
56
            });
57
        }
58
59
        return state.mergeIn([action.stateKey], fromJS({
60
            columns: action.columns,
61
            lastUpdate: generateLastUpdate()
62
        }));
63
64
    default:
65
66
        return state;
67
    }
68
}
69
70
export const setColumnsInStorage = ({ columns, stateKey }) => {
0 ignored issues
show
Unused Code introduced by
The constant setColumnsInStorage seems to be never used. Consider removing it.
Loading history...
71
    debouncedColumnSetter({
72
        stateKey: stateKey,
73
        property: 'columns',
74
        value: columns
75
    });
76
};
77