You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reducer.js 862B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // @flow
  2. import { ReducerRegistry } from '../redux';
  3. import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes';
  4. ReducerRegistry.register('features/base/app', (state = {}, action) => {
  5. switch (action.type) {
  6. case APP_WILL_MOUNT: {
  7. const { app } = action;
  8. if (state.app !== app) {
  9. return {
  10. ...state,
  11. /**
  12. * The one and only (i.e. singleton) {@link BaseApp} instance
  13. * which is currently mounted.
  14. *
  15. * @type {BaseApp}
  16. */
  17. app
  18. };
  19. }
  20. break;
  21. }
  22. case APP_WILL_UNMOUNT:
  23. if (state.app === action.app) {
  24. return {
  25. ...state,
  26. app: undefined
  27. };
  28. }
  29. break;
  30. }
  31. return state;
  32. });