Skip to content

Instantly share code, notes, and snippets.


NidhiKJha/ Secret

Last active Aug 19, 2020
What would you like to do?
Redux documentation of primero

Redux Documentation

Middleware -

Provides a third party extension point between dispatching an action and the moment it reaches the reducer.

In Primero V2, we have used the following Middlewares:

1. Thunk Middleware -

Thunk middleware allows you to write action creators that return a function instead of an action. The thunk can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met.

2. Router Middleware

Keeps the location of router in sync with redux

3. Redux Devtools

Developer Tools to power-up Redux development workflow or any other architecture which handles the state change

4. Logger

Logs the previous state, action and the new state in the app whenever a new action is fired

We also have Three Custom middleware

Redux provides with API called applyMiddleware which allows us to use custom middleware

1. restMiddleware

  • Rest Middleware decides if Data fetched from API has been cached or not.

2. offlineMiddleware

  • Offline caching of redux store

3. authMiddleware

  • Ensures user is authenticated before accessing the app


Reducers specify how the application's state changes in response to actions sent to the store.

The list of reducers used in the app can be found here primero/app/javascript/reducer.js

1. applicationReducer

  • System Settings and Network Status handling

2. flaggingReducer

3. i18nReducer

  • Switching language in the app

4. navReducer

  • On change in Nav, it changes the api path

5. notifierReducer

  • handles state related to the notification bar like adding, closing and removing a snackbar.

6. dashboardReducer

  • Handles Dashboard data loading - Success, failure and loading state

7. exportListReducer-

  • Handles Export Lists

8. loginFormReducer -

  • Handles Form Login state

9. loginReducer -

Handles state when we are logged in

10. recordActionsReducer -

Handles Sorting in Tables (filter)

11. requestApprovalReducer

12. bulkTranstionsReducer

13. potentialMatchesReducer

14. reportReducer

15. reportsListReducer

16. reportFormReducer

17. supportReducer

18. taskListReducer

19. usersListReducer

20. usersFormReducer

21. userGroupsListReducer

22. userGroupsFormReducer

23. agenciesListReducer

24. agenciesFormReducer

25. contactInformationReducer

26. rolesListReducer

27. rolesFormReducer

28. recordActionsTransitionsReducer

29. recordFormReducer

30. recordsReducer

31. savedSearchesReducer

32. transitionsReducer

33. userReducer

34. indexFiltersReducer

35. transferRequestReducer

36. transferApprovalReducer

37. revokeModalReducer

38. referralActionReducer

39. lookupsListReducer

40. AdminLookupsFormReducers

41. adminFormListReducer

42. adminFormBuilderReducer

43. AuditLogsReducers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment