diff --git a/app/actions/index.ts b/app/actions/index.ts index d5e2af267..168a37ab4 100644 --- a/app/actions/index.ts +++ b/app/actions/index.ts @@ -119,7 +119,7 @@ export function actionToKBar( } export async function performAction(action: Action, context: ActionContext) { - return action.perform?.(context).catch((err: Error) => { + return action.perform?.(context)?.catch((err: Error) => { toast.error(err.message); }); } diff --git a/app/components/ActionButton.tsx b/app/components/ActionButton.tsx index eb67d988d..8d94e0cc6 100644 --- a/app/components/ActionButton.tsx +++ b/app/components/ActionButton.tsx @@ -2,6 +2,7 @@ import * as React from "react"; import Tooltip, { Props as TooltipProps } from "~/components/Tooltip"; import { performAction } from "~/actions"; +import useIsMounted from "~/hooks/useIsMounted"; import { Action, ActionContext } from "~/types"; export type Props = React.HTMLAttributes & { @@ -25,6 +26,7 @@ const ActionButton = React.forwardRef( { action, context, tooltip, hideOnActionDisabled, ...rest }: Props, ref: React.Ref ) { + const isMounted = useIsMounted(); const [executing, setExecuting] = React.useState(false); const disabled = rest.disabled; @@ -64,7 +66,9 @@ const ActionButton = React.forwardRef( const response = performAction(action, actionContext); if (response?.finally) { setExecuting(true); - void response.finally(() => setExecuting(false)); + void response.finally( + () => isMounted() && setExecuting(false) + ); } } : rest.onClick diff --git a/app/components/InputSelect.tsx b/app/components/InputSelect.tsx index 49456f71c..dfb29304f 100644 --- a/app/components/InputSelect.tsx +++ b/app/components/InputSelect.tsx @@ -74,6 +74,7 @@ const InputSelect = (props: Props, ref: React.RefObject) => { disabled, note, icon, + nude, ...rest } = props; @@ -179,6 +180,7 @@ const InputSelect = (props: Props, ref: React.RefObject) => { disclosure className={className} icon={icon} + $nude={nude} {...props} > {getOptionFromValue(options, select.selectedValue)?.label || ( @@ -261,7 +263,7 @@ const Spacer = styled.div` flex-shrink: 0; `; -const StyledButton = styled(Button)<{ nude?: boolean }>` +const StyledButton = styled(Button)<{ $nude?: boolean }>` font-weight: normal; text-transform: none; margin-bottom: 16px; @@ -274,7 +276,7 @@ const StyledButton = styled(Button)<{ nude?: boolean }>` } ${(props) => - props.nude && + props.$nude && css` border-color: transparent; box-shadow: none;