Skip to content

Instantly share code, notes, and snippets.

@NidhiKJha
Last active August 19, 2020 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NidhiKJha/66aa35ebdfb7b27ee138c858ffbbd800 to your computer and use it in GitHub Desktop.
Save NidhiKJha/66aa35ebdfb7b27ee138c858ffbbd800 to your computer and use it in GitHub Desktop.
Redux documentation of primero

Redux Documentation

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:

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.

Keeps the location of router in sync with redux

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

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