Skip to content

Commit

Permalink
fix: re-render components, omit prop
Browse files Browse the repository at this point in the history
  • Loading branch information
nedpals committed Nov 24, 2024
1 parent 69e65b7 commit 38d8888
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions lib/components/FormComponentSlots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ const FormComponentSlots = memo(
} = props.preference;

// Memoize all components
const byType = useMemo(() => _byType, []);
const byFormType = useMemo(() => _byFormType, []);
const byProperty = useMemo(() => _byProperty, []);
const byCustomType = useMemo(() => _byCustomType, []);
const byCustomControlType = useMemo(() => _byCustomControlType, []);
const byLayoutName = useMemo(() => _byLayoutName, []);
const byType = useMemo(() => _byType, [_byType]);
const byFormType = useMemo(() => _byFormType, [_byFormType]);
const byProperty = useMemo(() => _byProperty, [_byProperty]);
const byCustomType = useMemo(() => _byCustomType, [_byCustomType]);
const byCustomControlType = useMemo(
() => _byCustomControlType,
[_byCustomControlType],
);
const byLayoutName = useMemo(() => _byLayoutName, [_byLayoutName]);

// Hierarchical order of precedence for component lookup:
// 1. formComponentsByProperty
Expand Down
2 changes: 1 addition & 1 deletion lib/simple_form/context_component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function SimpleForm<T = unknown>({
onChange,
onEvent,
value,
}: Omit<SimpleFormContextValue<T>, "getValue" | "setValue"> & {
}: Omit<SimpleFormContextValue<T>, "getValue" | "setValue" | "dispatch"> & {
onEvent?: (name: string, payload: unknown) => void;
children: ReactNode;
}) {
Expand Down

0 comments on commit 38d8888

Please sign in to comment.