github.com/stampzilla/stampzilla-go@v2.0.0-rc9+incompatible/nodes/stampzilla-server/web/src/middlewares/savedstates.js (about)

     1  import { write } from '../components/Websocket';
     2  
     3  const savedstates = store => next => (action) => {
     4    const prev = store.getState().getIn(['savedstates', 'list']);
     5    const result = next(action);
     6    const after = store.getState().getIn(['savedstates', 'list']);
     7  
     8    if (!after.equals(prev) && action.type !== 'savedstates_UPDATE') {
     9      write({
    10        type: 'update-savedstates',
    11        body: after.toJS(),
    12      });
    13    }
    14    return result;
    15  };
    16  
    17  export default savedstates;