Skip to content

Conversation

mumbler6
Copy link
Contributor

Fixes #733

@mumbler6 mumbler6 requested a review from angrave June 11, 2024 02:45
@mumbler6 mumbler6 force-pushed the 733-inote-editor-dont-use-index-position-for-keys-for-items-in-a-react-list branch from eaf7524 to 12b60bf Compare June 11, 2024 02:56
@mumbler6
Copy link
Contributor Author

Force pushed to remove test case files that will be going in a separate draft PR.

/>
))}
{contents.map((content, index) => {
const uuid = uuidv4();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small readability improvement if you change the key to ch-content-${id}-${uuidv4()} instead of having a variable you don't need the extra set of brackets and return keyword for these components. Since we only call the function once, I think not having a variable is fine in this case.

@@ -1,5 +1,6 @@
import React from 'react';
import { CTFragment } from 'layout';
import { v4 as uuidv4 } from 'uuid';
Copy link
Member

@harsh183 harsh183 Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uuidv4 is totally a better name, nice pick!


return (
<Box style={boxstyle}>
<Box style={boxstyle} data-testid="tag">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can rename the test id to include the component name like "ChapterContent-test-tag" in the case we ever have a test with lots of different components?

@harsh183
Copy link
Member

Great PR! I've left some comments here and #823

Copy link
Collaborator

@angrave angrave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@angrave angrave merged commit e4812ae into staging Jun 11, 2024
@angrave angrave deleted the 733-inote-editor-dont-use-index-position-for-keys-for-items-in-a-react-list branch June 11, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

INote editor don't use index position for keys for items in a react list

3 participants