Skip to content

Commit

Permalink
Move forwardRef outside of functions to avoid redefinitions
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <tsmock@meta.com>
  • Loading branch information
tsmock committed Apr 19, 2023
1 parent 0d23529 commit 3398ff9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/deleteModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { DeleteButton } from '../teamsAndOrgs/management';
import { Button } from '../button';
import { AlertIcon } from '../svgIcons';

const DeleteTrigger = React.forwardRef((props, ref) => <DeleteButton {...props} />);

export function DeleteModal({ id, name, type, className }: Object) {
const navigate = useNavigate();
const token = useSelector((state) => state.auth.token);
Expand All @@ -33,8 +35,6 @@ export function DeleteModal({ id, name, type, className }: Object) {
});
};

const DeleteTrigger = React.forwardRef((props, ref) => <DeleteButton {...props} />);

return (
<Popup
trigger={<DeleteTrigger className={`${className || ''} dib ml3`} />}
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ const UserDisplay = ({ username }) => {
);
};

const SignupTrigger = forwardRef((props, ref) => (
<Button className={signUpStyle} {...props}>
{alternativeSignUpText ? (
<FormattedMessage {...messages.createAccount} />
) : (
<FormattedMessage {...messages.signUp} />
)}
</Button>
));

export const AuthButtons = ({
logInStyle,
signUpStyle,
Expand All @@ -220,16 +230,6 @@ export const AuthButtons = ({
{ leading: true },
);

const SignupTrigger = forwardRef((props, ref) => (
<Button className={signUpStyle} {...props}>
{alternativeSignUpText ? (
<FormattedMessage {...messages.createAccount} />
) : (
<FormattedMessage {...messages.signUp} />
)}
</Button>
));

return (
<>
<Button onClick={() => debouncedCreateLoginWindow(redirectTo)} className={`${logInStyle}`}>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/projectEdit/actionsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,13 @@ const TransferProject = ({ projectId, orgId }: Object) => {
);
};

const FormattedButtonTrigger = React.forwardRef((props, ref) => (
<Button {...props}>{props.children}</Button>
));

export const ActionsForm = ({ projectId, projectName, orgId }: Object) => {
const navigate = useNavigate();

const FormattedButtonTrigger = React.forwardRef((props, ref) => (
<Button {...props}>{props.children}</Button>
));

return (
<div className="w-100">
<div className={styleClasses.divClass}>
Expand Down

0 comments on commit 3398ff9

Please sign in to comment.