Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code] fix main page #29811

Merged
merged 1 commit into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions x-pack/plugins/code/public/components/editor/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ export class EditorComponent extends React.Component<IProps> {
if (this.props.revealPosition) {
this.revealPosition(this.props.revealPosition);
}
if (this.props.showBlame) {
this.loadBlame(this.props.blames);
}
});
}
if (this.props.showBlame) {
this.loadBlame(this.props.blames);
}
}

public componentWillReceiveProps(nextProps: Props) {
Expand Down Expand Up @@ -111,9 +111,8 @@ export class EditorComponent extends React.Component<IProps> {
macModifier={[Modifier.meta]}
winModifier={[Modifier.ctrl]}
/>
<EuiFlexItem
<div
tabIndex={0}
grow={1}
className="code-editor-container"
id="mainEditor"
style={{ paddingLeft: this.props.showBlame ? 300 : 0 }}
Expand All @@ -124,8 +123,11 @@ export class EditorComponent extends React.Component<IProps> {
}

public loadBlame(blames: GitBlame[]) {
if (this.blameWidgets) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it's worth to check if the currently rendered blame matches the current file so that we don't need to load the blames again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

loadBlame only invoked when blames change or toggle show blame

Copy link
Contributor

Choose a reason for hiding this comment

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

as long as toggling the blame in the same file won't trigger additional blame data fetching, it should be fine.

this.destroyBlameWidgets();
}
this.blameWidgets = blames.map((b, index) => {
return new BlameWidget(b, index === 0, this.editor!);
return new BlameWidget(b, index === 0, this.monaco!.editor!);
});
}

Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/code/public/components/main/side_tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const Container = styled.div`
width: calc(256rem / 14);
border-right: ${theme.euiBorderThin};
display: flex;
flex-grow: 0;
flex-shrink: 0;
flex-direction: column;
& > div {
height: 100%;
Expand Down