chore: add missing keys to components inside lists (#19161)

This commit is contained in:
Diego Medina 2022-03-21 17:47:48 -04:00 committed by GitHub
parent d771ddbb94
commit 54f1b35161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 11 deletions

View File

@ -143,6 +143,7 @@ export function DndColumnSelect(props: DndColumnSelectProps) {
optionSelector.values.map((column, idx) => optionSelector.values.map((column, idx) =>
isFeatureEnabled(FeatureFlag.ENABLE_DND_WITH_CLICK_UX) ? ( isFeatureEnabled(FeatureFlag.ENABLE_DND_WITH_CLICK_UX) ? (
<ColumnSelectPopoverTrigger <ColumnSelectPopoverTrigger
key={idx}
columns={popoverOptions} columns={popoverOptions}
onColumnEdit={newColumn => { onColumnEdit={newColumn => {
if (isColumnMeta(newColumn)) { if (isColumnMeta(newColumn)) {

View File

@ -134,8 +134,13 @@ const WelcomeNav = styled.div`
export const LoadingCards = ({ cover }: LoadingProps) => ( export const LoadingCards = ({ cover }: LoadingProps) => (
<CardContainer showThumbnails={cover} className="loading-cards"> <CardContainer showThumbnails={cover} className="loading-cards">
{[...new Array(loadingCardCount)].map(() => ( {[...new Array(loadingCardCount)].map((_, index) => (
<ListViewCard cover={cover ? false : <></>} description="" loading /> <ListViewCard
key={index}
cover={cover ? false : <></>}
description=""
loading
/>
))} ))}
</CardContainer> </CardContainer>
); );

View File

@ -205,7 +205,7 @@ export function Menu({
}: MenuProps) { }: MenuProps) {
const [showMenu, setMenu] = useState<MenuMode>('horizontal'); const [showMenu, setMenu] = useState<MenuMode>('horizontal');
const screens = useBreakpoint(); const screens = useBreakpoint();
const uiConig = useUiConfig(); const uiConfig = useUiConfig();
const theme = useTheme(); const theme = useTheme();
useEffect(() => { useEffect(() => {
@ -221,7 +221,7 @@ export function Menu({
}, []); }, []);
const standalone = getUrlParam(URL_PARAMS.standalone); const standalone = getUrlParam(URL_PARAMS.standalone);
if (standalone || uiConig.hideNav) return <></>; if (standalone || uiConfig.hideNav) return <></>;
const renderSubMenu = ({ const renderSubMenu = ({
label, label,
@ -297,8 +297,9 @@ export function Menu({
data-test="navbar-top" data-test="navbar-top"
className="main-nav" className="main-nav"
> >
{menu.map(item => { {menu.map((item, index) => {
const props = { const props = {
index,
...item, ...item,
isFrontendRoute: isFrontendRoute(item.url), isFrontendRoute: isFrontendRoute(item.url),
childs: item.childs?.map(c => { childs: item.childs?.map(c => {

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import React, { useState } from 'react'; import React, { Fragment, useState } from 'react';
import { MainNav as Menu } from 'src/components/Menu'; import { MainNav as Menu } from 'src/components/Menu';
import { t, styled, css, SupersetTheme } from '@superset-ui/core'; import { t, styled, css, SupersetTheme } from '@superset-ui/core';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
@ -195,22 +195,22 @@ const RightMenu = ({
if (menu.childs) { if (menu.childs) {
return canDatabase || canUpload ? ( return canDatabase || canUpload ? (
<SubMenu <SubMenu
key="sub2" key={`sub2_${menu.label}`}
className="data-menu" className="data-menu"
title={menuIconAndLabel(menu)} title={menuIconAndLabel(menu)}
> >
{menu.childs.map((item, idx) => {menu.childs.map((item, idx) =>
typeof item !== 'string' && item.name && item.perm ? ( typeof item !== 'string' && item.name && item.perm ? (
<> <Fragment key={item.name}>
{idx === 2 && <Menu.Divider />} {idx === 2 && <Menu.Divider />}
<Menu.Item key={item.name}> <Menu.Item>
{item.url ? ( {item.url ? (
<a href={item.url}> {item.label} </a> <a href={item.url}> {item.label} </a>
) : ( ) : (
item.label item.label
)} )}
</Menu.Item> </Menu.Item>
</> </Fragment>
) : null, ) : null,
)} )}
</SubMenu> </SubMenu>
@ -257,7 +257,9 @@ const RightMenu = ({
return null; return null;
})} })}
</Menu.ItemGroup>, </Menu.ItemGroup>,
index < settings.length - 1 && <Menu.Divider />, index < settings.length - 1 && (
<Menu.Divider key={`divider_${index}`} />
),
])} ])}
{!navbarRight.user_is_anonymous && [ {!navbarRight.user_is_anonymous && [