You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the data doesn't contain an id field for each item, the workload is now generating keys for each <li> element dynamically while rendering, using uuidv4().
This will cause keys to never match up between renders, leading to these elements being recreated every time, which defeats the purpose of keys and slows the performance [1].
Besides, this implementation seems inconsistent with that of NewsSite-Nuxt, which uses item.id (which is undefined) as the key binding directly.
@lingyuncai - thanks for the issue and your solution.
I opened a separate pr, where I added the unique ids to the actual data files.
In that way we don't even need to generate them at any point in the app.
Since the data doesn't contain an
id
field for each item, the workload is now generating keys for each<li>
element dynamically while rendering, usinguuidv4()
.Speedometer/resources/newssite/news-next/src/components/article/article-content.jsx
Lines 23 to 32 in 3150f41
This will cause keys to never match up between renders, leading to these elements being recreated every time, which defeats the purpose of keys and slows the performance [1].
Besides, this implementation seems inconsistent with that of NewsSite-Nuxt, which uses
item.id
(which is undefined) as the key binding directly.Speedometer/resources/newssite/news-nuxt/components/atoms/ArticleContent.vue
Lines 29 to 34 in 3150f41
[1] https://react.dev/learn/rendering-lists#rules-of-keys
The text was updated successfully, but these errors were encountered: