Skip to content

Commit a46605d

Browse files
committed
fix array with missing keys react error in first row of buttons in +new pages
1 parent d54395a commit a46605d

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

src/packages/frontend/project/new/file-type-selector.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export function FileTypeSelector({
423423
function addAiDocGenerate(btn: JSX.Element, ext: Ext) {
424424
if (isFlyout) {
425425
return (
426-
<Col sm={sm} md={md}>
426+
<Col sm={sm} md={md} key={`with-ai-${ext}`}>
427427
<Flex align="flex-start" vertical={false} gap={"5px"}>
428428
<Flex flex={"1 1 auto"}>{btn}</Flex>
429429
<Flex flex={"0 0 auto"}>
@@ -439,7 +439,7 @@ export function FileTypeSelector({
439439
);
440440
} else {
441441
return (
442-
<Col sm={sm} md={md}>
442+
<Col sm={sm} md={md} key={`with-ai-${ext}`}>
443443
{btn}
444444
<AIGenerateDocumentButton
445445
project_id={project_id}
@@ -458,6 +458,7 @@ export function FileTypeSelector({
458458

459459
const btn = (
460460
<Tip
461+
key="quarto-button"
461462
delayShow={DELAY_SHOW_MS}
462463
title="Quarto File"
463464
icon={NEW_FILETYPE_ICONS.qmd}
@@ -482,6 +483,7 @@ export function FileTypeSelector({
482483

483484
const btn = (
484485
<Tip
486+
key="latex-button"
485487
delayShow={DELAY_SHOW_MS}
486488
title={intl.formatMessage(labels.latex_document)}
487489
icon={NEW_FILETYPE_ICONS.tex}
@@ -507,6 +509,7 @@ export function FileTypeSelector({
507509
function renderMD() {
508510
const btn = (
509511
<Tip
512+
key="markdown-button"
510513
delayShow={DELAY_SHOW_MS}
511514
title="Computational Markdown Document"
512515
icon={NEW_FILETYPE_ICONS.md}

src/packages/frontend/project/new/jupyter-buttons.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ export function JupyterNotebookButtons({
8888
// Sept 2024: adding "Sage Notebook", as part of deprecating "Sage Worksheet"
8989
const { error, kernel_selection, kernels_by_name } = useJupyterKernelsInfo();
9090

91-
if (!availableFeatures.jupyter_notebook) return null;
91+
if (!availableFeatures.jupyter_notebook) {
92+
return null;
93+
}
9294

9395
async function createNotebook(kernelName: string) {
9496
if (
@@ -280,21 +282,19 @@ export function JupyterNotebookButtons({
280282

281283
if (isFlyout) {
282284
return btns.map(({ btn, lang }, i) => (
283-
<>
284-
<Col key={i} sm={sm} md={md}>
285-
<Flex align="flex-start" vertical={false} gap={"5px"}>
286-
<Flex flex={"1 1 auto"}>{btn}</Flex>
287-
<Flex flex={"0 0 auto"}>
288-
<AIGenerateDocumentButton
289-
project_id={project_id}
290-
mode="flyout"
291-
ext={langs.includes(lang as any) ? "ipynb-sagemath" : "ipynb"}
292-
filename={filenameChanged ? filename : undefined}
293-
/>
294-
</Flex>
285+
<Col key={i} sm={sm} md={md}>
286+
<Flex align="flex-start" vertical={false} gap={"5px"}>
287+
<Flex flex={"1 1 auto"}>{btn}</Flex>
288+
<Flex flex={"0 0 auto"}>
289+
<AIGenerateDocumentButton
290+
project_id={project_id}
291+
mode="flyout"
292+
ext={langs.includes(lang as any) ? "ipynb-sagemath" : "ipynb"}
293+
filename={filenameChanged ? filename : undefined}
294+
/>
295295
</Flex>
296-
</Col>
297-
</>
296+
</Flex>
297+
</Col>
298298
));
299299
} else {
300300
return btns.map(({ btn, lang }, i) => (

0 commit comments

Comments
 (0)