Skip to content

Commit

Permalink
cleanup unnecessary getInput() calls
Browse files Browse the repository at this point in the history
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
  • Loading branch information
ruanyl committed Aug 7, 2024
1 parent c757317 commit 70ce43f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ export class EmbeddablePanel extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
const { embeddable } = this.props;
const viewMode = embeddable.getInput().viewMode ?? ViewMode.EDIT;
const hidePanelTitle =
Boolean(embeddable.parent?.getInput()?.hidePanelTitles) ||
Boolean(embeddable.getInput()?.hidePanelTitles);
const input = embeddable.getInput();
const parentInput = embeddable.parent?.getInput();

const viewMode = input?.viewMode ?? ViewMode.EDIT;
const hidePanelTitle = Boolean(parentInput?.hidePanelTitles) || Boolean(input?.hidePanelTitles);
const hidePanelAction =
Boolean(embeddable.parent?.getInput()?.hidePanelActions) ||
Boolean(embeddable.getInput()?.hidePanelActions);
Boolean(parentInput?.hidePanelActions) || Boolean(input?.hidePanelActions);

this.state = {
panels: [],
Expand Down Expand Up @@ -187,15 +187,15 @@ export class EmbeddablePanel extends React.Component<Props, State> {
if (parent) {
this.parentSubscription = parent.getInput$().subscribe(async () => {
if (this.mounted && parent) {
const input = embeddable.getInput();
const parentInput = parent.getInput();
this.setState({
hidePanelTitle:
Boolean(embeddable.parent?.getInput()?.hidePanelTitles) ||
Boolean(embeddable.getInput()?.hidePanelTitles),
Boolean(parentInput?.hidePanelTitles) || Boolean(input?.hidePanelTitles),
});
this.setState({
hidePanelAction:
Boolean(embeddable.parent?.getInput()?.hidePanelActions) ||
Boolean(embeddable.getInput()?.hidePanelActions),
Boolean(parentInput?.hidePanelActions) || Boolean(input?.hidePanelActions),
});

this.refreshBadges();
Expand Down

0 comments on commit 70ce43f

Please sign in to comment.