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

Issue 7561/emotion memoize all generated styles eui tool tip+euicon tip #8240

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

rebeca1012
Copy link

Summary

Memoize Tooltip and Popover components to prevent unnecessary re-renders (Issue #7561)

Detailed Changes

tool_tip_arrow.tsx

export const EuiToolTipArrow: FunctionComponent<
  { position: ToolTipPositions } & HTMLAttributes<HTMLDivElement>
> = ({ position, ...props }) => {
  const styles = useEuiMemoizedStyles(euiToolTipStyles);

Used useEuiMemoizedStyles to memoize the Tooltip component.

_popover_arrow.tsx

import { useEuiMemoizedStyles } from '../../../services';

export const POSITIONS = ['top', 'left', 'right', 'bottom'] as const;
export type EuiPopoverArrowPositions = (typeof POSITIONS)[number];
	@@ -24,8 +24,7 @@ export const EuiPopoverArrow: FunctionComponent<EuiPopoverArrowProps> = ({
  position,
  ...rest
}) => {
  const styles = useEuiMemoizedStyles(euiPopoverArrowStyles);

Used useEuiMemoizedStyles to memoize _popover_arrow.tsx

popover_footer.tsx

import { useEuiMemoizedStyles } from '../../services';
import { CommonProps } from '../common';
import { euiPopoverFooterStyles } from './popover_footer.styles';
import { EuiPopoverPanelContext } from './popover_panel/_popover_panel';
	@@ -32,8 +32,7 @@ export const EuiPopoverFooter: EuiPopoverFooterProps = ({
  ...rest
}) => {
  const { paddingSize: panelPadding } = useContext(EuiPopoverPanelContext);
  const styles = useEuiMemoizedStyles(euiPopoverFooterStyles);

Used useEuiMemoizedStyles to memoize popover_footer.tsx

popover_title.tsx

import { useEuiMemoizedStyles } from '../../services';
import { CommonProps } from '../common';
import { euiPopoverTitleStyles } from './popover_title.styles';
import { EuiPopoverPanelContext } from './popover_panel/_popover_panel';
	@@ -32,8 +32,7 @@ export const EuiPopoverTitle: EuiPopoverTitleProps = ({
  ...rest
}) => {
  const { paddingSize: panelPadding } = useContext(EuiPopoverPanelContext);
  const styles = useEuiMemoizedStyles(euiPopoverTitleStyles);

Used useEuiMemoizedStyles to memoize popover_title.tsx

QA

Remove or strikethrough items that do not apply to your PR.

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

@rebeca1012 rebeca1012 requested a review from a team as a code owner December 14, 2024 03:41
Copy link

❌ Author of the following commits did not sign a Contributor Agreement:
42e03fa, 94ebcf8, 07645ee, 2842e3a, 05192a9, f527695, , 527e61e, 8ccc7d1, 2c37398

Please, read and sign the above mentioned agreement if you want to contribute to this project

Copy link

👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants