Not all actions are being saved. #179

Open
opened 2018-04-24 20:22:11 +00:00 by SLYtiger16 · 0 comments
SLYtiger16 commented 2018-04-24 20:22:11 +00:00 (Migrated from github.com)

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.

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.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MichaelContento/redux-storage#179
No description provided.