Skip to content

Commit

Permalink
fix(pci-common): fix flashing effect on shapes input component
Browse files Browse the repository at this point in the history
Signed-off-by: Mohammed Hamdoune <[email protected]>
  • Loading branch information
sidlynx committed Jan 3, 2025
1 parent e794a6d commit c8592bf
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import clsx from 'clsx';
import isEqual from 'lodash.isequal';
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { AccordionComponent } from '../accordion/Accordion.component';
import { DefaultItemLabelComponent } from './default-components/item-label';
import { DefaultStackLabelComponent } from './default-components/stack-label';
Expand Down Expand Up @@ -118,19 +118,23 @@ export const ShapesInputComponent = function ShapesInputComponent<T>({
group: undefined,
});

const LabelComponent = memo(
item?.LabelComponent || DefaultItemLabelComponent,
const LabelComponent = useMemo(
() => item?.LabelComponent || DefaultItemLabelComponent,
[item?.LabelComponent],
);
const StackLabelComponent = memo(
stack?.LabelComponent || DefaultStackLabelComponent,
const StackLabelComponent = useMemo(
() => stack?.LabelComponent || DefaultStackLabelComponent,
[stack?.LabelComponent],
);
const StackTitleComponent = memo(
stack?.TitleComponent || DefaultStackTitleComponent,
const StackTitleComponent = useMemo(
() => stack?.TitleComponent || DefaultStackTitleComponent,
[stack?.TitleComponent],
);
const GroupLabelComponent = memo(
group?.LabelComponent || DefaultGroupLabelComponent,
const GroupLabelComponent = useMemo(
() => group?.LabelComponent || DefaultGroupLabelComponent,
[group?.LabelComponent],
);
const ShapeComponent = memo(DefaultShapeComponent);
const ShapeComponent = DefaultShapeComponent;

const groupHandler = {
itemsMap: useMemo(() => {
Expand Down

0 comments on commit c8592bf

Please sign in to comment.