Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Not all actions are being saved. #179

Open
SLYtiger16 opened this issue Apr 24, 2018 · 0 comments
Open

Not all actions are being saved. #179

SLYtiger16 opened this issue Apr 24, 2018 · 0 comments

Comments

@SLYtiger16
Copy link

SLYtiger16 commented Apr 24, 2018

Despite the setup as below with no blacklisted or whitelisted actions, once I dispatch sertain actions all saving stops for the entire app.

const reducer = storage.reducer(combineReducers({
  menu: menuReducer,
  axios: axiosReducer,
  admin: combineReducers({
    storage: storageReducer,
    classes: classesReducer,
    classEdit: classEditReducer,
    classEditStudents: classEditStudentsReducer,
    deleteConfirm: deleteConfirmReducer,
    actionConfirm: actionConfirmReducer,
    saveDialog: saveDialogReducer,
    admins: adminsReducer,
    adminEdit: adminEditReducer,
    students: studentsReducer,
    studentView: studentViewReducer
  })
}));
const engine = createEngine('vs45tgfr5678ikhy');
const middleware = [thunk, storage.createMiddleware(engine)];
const store = createStore(
  reducer,
  applyMiddleware(...middleware)
);
const load = storage.createLoader(engine);
load(store);

load(store)
  .then((newState) => console.log('STATE LOADED FROM INDEXED D:', newState))
  .catch(() => console.log('Failed to load previous state from local db!'));

export default store;

Fails on anything dispatched in the deleteConfirm:

let initialState = {
    show: false,
    action: null,
    params: null,
    item: null
};

const deleteConfirmReducer = (state = initialState, action) => {
    let newState = {};
    let data = action.payload;

    switch (action.type) {
        case 'DELETE_CONFIRM_HIDE':
            newState = Object.assign({}, state);
            newState = {
                show: false,
                action: state.action,
                params: state.params,
                item: state.item
            };
            return newState;

        case 'DELETE_CONFIRM_UPDATE':
            newState = Object.assign({}, state);
            newState = {
                show: true,
                action: (!data.action) ? null : data.action,
                params: (!data.params) ? null : data.params,
                item: (!data.item) ? null : data.item
            };
            return newState;

        case 'DELETE_CONFIRM_RESET':
            newState = Object.assign({}, state);
            newState = {
                show: false,
                action: null,
                params: null,
                item: null
            };
            return newState;

        default:
            return state;
    }
};

export default deleteConfirmReducer;

I cannot seem to find anything as to why.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant