mirror of
https://github.com/xodio/xod.git
synced 2026-03-25 18:16:55 +01:00
fix(reducers): remove initial state from reducers
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import initialState from '../state';
|
||||
|
||||
export const editor = (state, action) => {
|
||||
const newState = (state === undefined) ? initialState.editor : state;
|
||||
export const editor = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
default:
|
||||
return newState;
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import initialState from '../state';
|
||||
import { LINK_ADD, LINK_DELETE } from '../actionTypes';
|
||||
import R from 'ramda';
|
||||
|
||||
@@ -24,8 +23,7 @@ const link = (state, action) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const links = (state, action) => {
|
||||
const newState = (state === undefined) ? initialState.project.links : state;
|
||||
export const links = (state = {}, action) => {
|
||||
let newLink = null;
|
||||
let newLinkId = 0;
|
||||
|
||||
@@ -38,6 +36,6 @@ export const links = (state, action) => {
|
||||
case LINK_DELETE:
|
||||
return R.omit([action.payload.id.toString()], state);
|
||||
default:
|
||||
return newState;
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { NODE_MOVE, NODE_ADD, NODE_DELETE } from '../actionTypes';
|
||||
import initialState from '../state';
|
||||
import R from 'ramda';
|
||||
|
||||
const nodeIds = (nodes) =>
|
||||
@@ -26,9 +25,7 @@ const node = (state, action) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const nodes = (state, action) => {
|
||||
const newState = (state === undefined) ? R.clone(initialState.project.nodes) : state;
|
||||
|
||||
export const nodes = (state = {}, action) => {
|
||||
let movedNode = null;
|
||||
let newNode = null;
|
||||
let newNodeId = 0;
|
||||
@@ -49,6 +46,6 @@ export const nodes = (state, action) => {
|
||||
return R.set(R.lensProp(action.payload.id), movedNode, state);
|
||||
|
||||
default:
|
||||
return newState;
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import initialState from '../state';
|
||||
import R from 'ramda';
|
||||
|
||||
export const nodeTypes = (state, action) => {
|
||||
const newState = (state === undefined) ? R.clone(initialState.nodeTypes) : state;
|
||||
|
||||
export const nodeTypes = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
default:
|
||||
return newState;
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import initialState from '../state';
|
||||
import R from 'ramda';
|
||||
|
||||
export const patches = (state, action) => {
|
||||
const newState = (state === undefined) ? R.clone(initialState.project.patches) : state;
|
||||
|
||||
export const patches = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
default:
|
||||
return newState;
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import initialState from '../state';
|
||||
import R from 'ramda';
|
||||
|
||||
export const pins = (state, action) => {
|
||||
const newState = (state === undefined) ? R.clone(initialState.project.pins) : state;
|
||||
export const pins = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
default:
|
||||
return newState;
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user