Select Git revision
dataconfig.pb.cc
mgSlice.js 576 B
import { createSlice } from '@reduxjs/toolkit'
export const mgSlice = createSlice({
name: 'mg',
initialState: {
asts: [],
contexts: {},
},
reducers: {
addAst: (state, action) => {
state.asts = [action.payload, ...state.asts];
console.log("added ast, size is " + state.asts.length);
},
setAstList: (state, action) => {
state.asts = action.payload.reverse();
console.log("set AST list, size is " + state.asts.length);
}
}
})
export const { addAst, setAstList } = mgSlice.actions
export default mgSlice.reducer