junior-dev-struggle-bus / juniordevstrugglebus

Website for the Junior Dev Struggle Bus Meetup
https://www.juniordevstrugglebus.com
MIT License
9 stars 18 forks source link

List children on Organization page are not provided keys #35

Closed Xoadra closed 4 years ago

Xoadra commented 4 years ago

While working on PR #34, I visited the Organization page and found the below error in my console:

Screen Shot 2019-10-22 at 12 55 48 AM

I checked the code and noticed that the lists of people for the board of directors and the executive team aren't providing keys to the <Position /> components that are being generated.

React recommends using immutable and distinct keys for list items but also cautions against simply incrementing a number to represent a key for each list item. Because there is identical information shared between list items, the solution to this complicates things a little.

That said, using an incremented number as a key for these may not be that big of a deal here, but I thought it would be worth mentioning at the very least. You could also just extend the map function and use the array's index argument for each list item instead.

Xoadra commented 4 years ago

I found another occurrence of this issue on the Resource page where resource objects are being mapped to individual <Resource /> components.

Here I would recommend using the links on the resource objects as the keys for these components since they should be unique (even though we don't enforce it yet) so as to not list a resource that's already been added.

hoangviet1993 commented 4 years ago

@Xoadra may I be assigned this issue? For /organization Since execList and bodList are constant, I think we are safe to use the map's indexes as keys here.

P.S https://juniordevstrugglebus.com/resources is having problem for me atm Screen Shot 2020-02-07 at 2 35 35 PM

since https://natespilman.tech/jdsb/resources/ is returning 502. So I can't really debug /resources

Xoadra commented 4 years ago

Go for it! I don't actually have assigning permissions but you're totally free to submit a PR for this issue if you'd like.

I'm not sure what the status of resources is so you'll have to ask @nspilman about that. He and I were working on moving stored resources from a Google spreadsheet over to FaunaDB but I don't know the status of that currently.