svsticky / radio

Random Afkorting voor Digitale Informatie Overdracht
https://radio.svsticky.nl/
MIT License
2 stars 3 forks source link

refactor: added redux store #140

Closed stickyPiston closed 2 weeks ago

stickyPiston commented 3 months ago

This PR proposes a big refactor of the state machine and the data fetching/separation in the entire application.

Originally, each component managed and fetched its own data within the component, and the App component managed the states. The components also sent information to App about how many activities, ads, etc. there are so the transition function could take that into account.

The new system uses redux, which creates a global store whose data is accessible to every component, but the mutations are controlled through actions. The advantage of using redux is that the data fetching logic is separated from the UI logic (i.e. the react components) and the state machine can use all data at once, which reduces the communication between components.

The changes in this PR are the following:

This PR should only be merged once #142 is merged.

SilasPeters commented 2 months ago

@josvanos do you happen to have time and would you like to help out with reviewing the JS here?

josvanos commented 2 months ago

Nice @stickyPiston! @SilasPeters I will code review this PR Saturday! I also will have a look at the typescript PR.

SilasPeters commented 2 months ago

Epic @josvanos , thanks for making time!

stickyPiston commented 2 months ago

@SilasPeters, About the testing without any activities: i haven't tested with any actual activities, however i want to create one more PR that adds some sort of mocking/testing. Having the redux store allows us to more easily mock all of the data, and therefore create tests more efficiently and reliably. I am still investigating what the most efficient way to do this is, so any input is greatly appreciated!