Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit d6527a9

Browse files
sebmarkbagefacebook-github-bot
authored andcommitted
Move more keys to static argument instead of spread
Summary: This pattern is deprecated. Key has to be spread as a static argument instead of through props. These are some of our highest firing callsites. Reviewed By: mrkev, gaearon Differential Revision: D19873502 fbshipit-source-id: 9dd43ae625edffbb3c5dbe29237f7b769726fa04
1 parent 6cfed73 commit d6527a9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/component/contents/DraftEditorBlock.react.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ class DraftEditorBlock extends React.Component<Props> {
213213
contentState: this.props.contentState,
214214
decoratedText,
215215
dir: dir,
216-
key: decoratorOffsetKey,
217216
start,
218217
end,
219218
blockKey,
@@ -222,7 +221,10 @@ class DraftEditorBlock extends React.Component<Props> {
222221
};
223222

224223
return (
225-
<DecoratorComponent {...decoratorProps} {...commonProps}>
224+
<DecoratorComponent
225+
{...decoratorProps}
226+
{...commonProps}
227+
key={decoratorOffsetKey}>
226228
{leaves}
227229
</DecoratorComponent>
228230
);

src/model/decorators/DraftDecorator.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export type DraftDecoratorComponentProps = {
6666
// undefined. That's why `getEntityKeyAt()` is typed to return `?string`.
6767
// See https://github.com/facebook/draft-js/blob/2da3dcb1c4c106d1b2a0f07b3d0275b8d724e777/src/model/immutable/BlockNode.js#L51
6868
entityKey: ?string,
69-
key: React.Key,
7069
offsetKey: string,
7170
start: number,
7271
...

0 commit comments

Comments
 (0)