Spetastian / mage-kit-client

MIT License
0 stars 2 forks source link

Minor bugs in spells-section #18

Closed Spetastian closed 8 years ago

Spetastian commented 8 years ago

Issue 1: No spells are initially rendered

When landing on "/spells"-page the list of spells are not initially shown. When writing e.g "a" in the search field, all spells beginning with the letter "a" are shown. After that, when clearing the search field all spells are shown.

The spells needs to be initially rendered. Investigate why it does not and fix it.

Issue 2: React complains about key-property for spell components in spell-list

For the spell-list react shows an error in the JavaScript console that looks like this:

warning.js?0260:36 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of Spell. See https://fb.me/react-warning-keys for more information. in span (created by Spell) in Spell (created by SpellList) in div (created by SpellList) in div (created by SpellList) in SpellList (created by Spells) in div (created by Spells) in Spells (created by Connect(Spells)) in Connect(Spells) (created by RouterContext) in main (created by App) in div (created by App) in App (created by RouterContext) in RouterContext (created by Router) in Router in Provider

When rendering a list of items with reatct, every item needs to have a unique "key"-property. In this case, the id-property of the spell object is used as a key. See "app/components/spells/spell-list.js". The problem can be that the every spell in the static data is not given a unique id-property. Look in the JSON-files at "data/spells".