Adventure-Bot / Adventure-Bot/adventure-bot

Normalized items

Offen
#9 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @brian-gates Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
7
Forks
6
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Problem: full copies of items exist everywhere. Reduce the size and redundancy of state by normalizing items within the character slice.

- [x] create `items` slice
- [x] create `itemCreated` action
- [x] dispatch `itemCreated` action whenever an item is added to the game
- [x] dispatch `itemDestroyed` action whenever an is removed from the game
- [ ] reduce `statsModified` in character slice on `itemEquipped` and `itemRemoved` (instead of within the selector)
- [ ] migrate character inventory and equipment to reference `items` slice
- [ ] update selectors to denormalize back to original shape

Success criteria: No `Item`s in the character slice, only ids. No change in behavior.

https://redux.js.org/usage/structuring-reducers/updating-normalized-data

Alternative for consideration: `inventory` slice.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.