dzintars / front

Test setup (Don't use!) Dev server URL available while i'm developing.
https://front.oswee.dev
1 stars 1 forks source link

Redux modules for the Features, not for Domains/Entities #82

Open dzintars opened 4 years ago

dzintars commented 4 years ago

It is wrong to think in terms of Domains/Entities when creating Redux module. Quite soon you will end up with the situation, when you want to combine slices from the different modules. Instead you should think in terms of Features. For example, i have this app-navigation component (so called - Feature). This components simply displays list of the modules for the given application. So, we need an application ID to get its module id's and then the rest of the data for the every module. This means we should hit 2 API endpoints to combine this data. Don't forget also about the data normalization. So, this seems a good case to implement app-navigation module in Redux. And it helps to maintain decoupling.

dzintars commented 4 years ago

I created API method to request all required data at one go. https://github.com/dzintars/wss/commit/24e448ef842b59266556fcd934dbfc05c36cb168 https://github.com/dzintars/wss/commit/595973262ea8978aaa8ae9ac5ac4638939ed8e14

This seems could work. For sure its quick and dirty, but the general idea is like that. Pass the app ID and get all the modules.

dzintars commented 4 years ago

Still need to play with this "ideology" for some time to feel comfortable with it.