[FIX] fixes the links view count not being sorted
Fixes Issue
closes #3434
Changes proposed
This was happening due to not having the correct key property while mapping over the link
Instead of using index as key, changed it to link.name
the Link has name, icon and url values in it, the name seemed the most optimal
Check List (Check all the applicable boxes)
- [x ] My code follows the code style of this project.
- [ ] My change requires changes to the documentation.
- [ ] I have updated the documentation accordingly.
- [ x] All new and existing tests passed.
- [ x] This PR does not contain plagiarized content.
- [ x] The title of my pull request is a short description of the requested changes.
Screenshots


Note to reviewers
If having link.name as the key is not the appropriate option, we can add an id on each link before mapping over it like this
data.links = data.links.map((link, i) => ({ id: i, ...link }));
By this, each link will also have a unique id field which can be used as a key
@ChinmayMhatre can you have a look at this Also tell me if using the name as key is a good practice or not, or I'll switch to the other method to fix the issue as I mentioned above
@ChinmayMhatre can you have a look at this Also tell me if using the name as key is a good practice or not, or I'll switch to the other method to fix the issue as I mentioned above
I think using the map's index would be better than using the name.
@ChinmayMhatre can you have a look at this Also tell me if using the name as key is a good practice or not, or I'll switch to the other method to fix the issue as I mentioned above
I'll take a look at the code at night.
@ChinmayMhatre can you have a look at this Also tell me if using the name as key is a good practice or not, or I'll switch to the other method to fix the issue as I mentioned above
I think using the map's index would be better than using the name.
Using index was the reason it was not working
@ChinmayMhatre can you have a look at this Also tell me if using the name as key is a good practice or not, or I'll switch to the other method to fix the issue as I mentioned above
I think using the map's index would be better than using the name.
Using index was the reason it was not working
I meant this
Note to reviewers
If having link.name as the key is not the appropriate option, we can add an id on each link before mapping over it like this
data.links = data.links.map((link, i) => ({ id: i, ...link }));
By this, each link will also have a unique id field which can be used as a key
You could try using this id
What about using url that will be unique?
Reviewpad Report
:information_source: Messages
- Kudos for your 10th pull request! You are awesome
What about using
urlthat will be unique?
can't say, it's user-defined that's why