Skip to content

A local-first personal finance app

fix split transaction button on desktop (#6269)

Matt Fiddamanf3799ba9f02e
diff --git a/packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx b/packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx
index 53ab7194f9..b4299d5975 100644
--- a/packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx
+++ b/packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx
@@ -136,12 +136,20 @@ function CategoryList({
}}
>
{splitTransaction &&
- renderSplitTransactionButton({
- key: 'split',
- ...(getItemProps ? getItemProps({ item: splitTransaction }) : {}),
- highlighted: splitTransaction.highlightedIndex === highlightedIndex,
- embedded,
- })}
+ (() => {
+ const splitButtonProps = getItemProps
+ ? getItemProps({ item: splitTransaction })
+ : {};
+ const { onClick, ...restSplitButtonProps } = splitButtonProps;
+ return renderSplitTransactionButton({
+ key: 'split',
+ ...restSplitButtonProps,
+ onClick,
+ highlighted:
+ splitTransaction.highlightedIndex === highlightedIndex,
+ embedded,
+ });
+ })()}
{groupedCategories.map(({ group, categories }) => {
if (!group) {
return null;
@@ -334,7 +342,7 @@ function defaultRenderCategoryItemGroupHeader(
return <ItemHeader {...props} type="category" />;
}
-type SplitTransactionButtonProps = {
+type SplitTransactionButtonProps = ComponentPropsWithoutRef<typeof View> & {
Icon?: ComponentType<SVGProps<SVGElement>>;
highlighted?: boolean;
embedded?: boolean;
diff --git a/upcoming-release-notes/6269.md b/upcoming-release-notes/6269.md
new file mode 100644
index 0000000000..9b3c2f2718
--- /dev/null
+++ b/upcoming-release-notes/6269.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [matt-fidd]
+---
+
+Fix split transaction button on desktop