You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/03/15 23:59:59 UTC

[GitHub] [superset] rusackas commented on a change in pull request #19161: chore: add missing keys in components inside lists

rusackas commented on a change in pull request #19161:
URL: https://github.com/apache/superset/pull/19161#discussion_r827509107



##########
File path: superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx
##########
@@ -143,6 +143,7 @@ export function DndColumnSelect(props: DndColumnSelectProps) {
       optionSelector.values.map((column, idx) =>
         isFeatureEnabled(FeatureFlag.ENABLE_DND_WITH_CLICK_UX) ? (
           <ColumnSelectPopoverTrigger
+            key={idx}

Review comment:
       It seems like the `optionSelector` values might change here, meaning using `idx` as the key here might not be a completely safe move. But then, *think* React uses the index by default if another key is not provided, so it's probably doing this already under the hood...
   
   Maybe we can use a better key? Maybe I'm overthinking this?

##########
File path: superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx
##########
@@ -143,6 +143,7 @@ export function DndColumnSelect(props: DndColumnSelectProps) {
       optionSelector.values.map((column, idx) =>
         isFeatureEnabled(FeatureFlag.ENABLE_DND_WITH_CLICK_UX) ? (
           <ColumnSelectPopoverTrigger
+            key={idx}

Review comment:
       It seems like the `optionSelector` values might change here, meaning using `idx` as the key here might not be a completely safe move. But then, *think* React uses the index by default if another key is not provided, so it's probably doing this already under the hood...
   
   Maybe we can use a better key? Maybe I'm overthinking this?

##########
File path: superset-frontend/src/views/CRUD/welcome/Welcome.tsx
##########
@@ -134,8 +134,13 @@ const WelcomeNav = styled.div`
 
 export const LoadingCards = ({ cover }: LoadingProps) => (
   <CardContainer showThumbnails={cover} className="loading-cards">
-    {[...new Array(loadingCardCount)].map(() => (
-      <ListViewCard cover={cover ? false : <></>} description="" loading />
+    {[...new Array(loadingCardCount)].map((_, index) => (
+      <ListViewCard
+        key={index}

Review comment:
       This one seems perfectly fine... it's a static map

##########
File path: superset-frontend/src/views/CRUD/welcome/Welcome.tsx
##########
@@ -134,8 +134,13 @@ const WelcomeNav = styled.div`
 
 export const LoadingCards = ({ cover }: LoadingProps) => (
   <CardContainer showThumbnails={cover} className="loading-cards">
-    {[...new Array(loadingCardCount)].map(() => (
-      <ListViewCard cover={cover ? false : <></>} description="" loading />
+    {[...new Array(loadingCardCount)].map((_, index) => (
+      <ListViewCard
+        key={index}

Review comment:
       This one seems perfectly fine... it's a static map




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org