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

Commit

Permalink
Move more keys to static argument instead of spread
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sebmarkbage authored and facebook-github-bot committed Feb 13, 2020
1 parent 6cfed73 commit d6527a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/component/contents/DraftEditorBlock.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ class DraftEditorBlock extends React.Component<Props> {
contentState: this.props.contentState,
decoratedText,
dir: dir,
key: decoratorOffsetKey,
start,
end,
blockKey,
Expand All @@ -222,7 +221,10 @@ class DraftEditorBlock extends React.Component<Props> {
};

return (
<DecoratorComponent {...decoratorProps} {...commonProps}>
<DecoratorComponent
{...decoratorProps}
{...commonProps}
key={decoratorOffsetKey}>
{leaves}
</DecoratorComponent>
);
Expand Down
1 change: 0 additions & 1 deletion src/model/decorators/DraftDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export type DraftDecoratorComponentProps = {
// undefined. That's why `getEntityKeyAt()` is typed to return `?string`.
// See https://github.com/facebook/draft-js/blob/2da3dcb1c4c106d1b2a0f07b3d0275b8d724e777/src/model/immutable/BlockNode.js#L51
entityKey: ?string,
key: React.Key,
offsetKey: string,
start: number,
...
Expand Down

0 comments on commit d6527a9

Please sign in to comment.