Skip to content

Commit

Permalink
fix: Fix forwardRef warning in split panel
Browse files Browse the repository at this point in the history
  • Loading branch information
just-boris committed Oct 16, 2024
1 parent ce7dff3 commit 475165d
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 222 deletions.
17 changes: 0 additions & 17 deletions src/internal/widgets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,3 @@ export function createWidgetizedComponent<Component extends FunctionComponent<an
}) as Component;
};
}

export function createWidgetizedForwardRef<
Props,
RefType,
Component extends React.ForwardRefExoticComponent<Props & React.RefAttributes<RefType>>,
>(Implementation: Component) {
return (Loader?: Component): Component => {
return React.forwardRef<RefType, Props>((props, ref) => {
const isRefresh = useVisualRefresh();
if (isRefresh && getGlobalFlag('appLayoutWidget') && Loader) {
return <Loader ref={ref} {...(props as any)} />;
}

return <Implementation ref={ref} {...(props as any)} />;
}) as Component;
};
}
Loading

0 comments on commit 475165d

Please sign in to comment.