[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate map state to a single reducer #503

Open
2Pacalypse- opened this issue Sep 16, 2020 · 0 comments
Open

Consolidate map state to a single reducer #503

2Pacalypse- opened this issue Sep 16, 2020 · 0 comments

Comments

@2Pacalypse-
Copy link
Member

Currently, each reducer which contains the map state in some way uses a complete MapRecord to represent those maps. This becomes a problem with some actions which need to update the map state in place (e.g. favoriting or editing a map). Because then, the map state needs to be updated in all the reducers that keep it.

Alternative would be to keep the MapRecord state in a single reducer, and keep the map IDs in all the other reducers. This would allow actions like favoriting or editing a map to only update state in a single place, the maps reducer. However, this new maps reducer would now have to handle all the other actions which fetch maps in some way. Below is the list of all the places we're doing that for now:

  • map-pools-reducer
  • lobby-list-reducer
  • lobby-preferences-reducer
  • lobby-reducer
  • maps-reducer (this should be renamed to server-maps-reducer)
  • matchmaking-preferences-reducer
  • matchmaking-reducer

So the general maps reducer would have to subscribe to all the actions that are used in the list above and merge their maps with the "global" list of maps that are currently fetched in the app. This includes removing a map from the list if it got deleted (which is possible to do for admins and private maps).

Future improvement: We should also probably handle map deletions in various parts of client UI. For example, what to do if a user deletes a map which is currently hosted in a lobby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant