mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 12:43:09 -05:00
Bugfix row render (#1402)
* Fix re-rendering all rows on hover * release note * Removing isHover logic in place of css :hover --------- Co-authored-by: biohzrddd <10577752+biohzrddd@users.noreply.github.com>
This commit is contained in:
@@ -678,7 +678,6 @@ const Transaction = memo(function Transaction(props) {
|
|||||||
showCleared,
|
showCleared,
|
||||||
showZeroInDeposit,
|
showZeroInDeposit,
|
||||||
style,
|
style,
|
||||||
hovered,
|
|
||||||
selected,
|
selected,
|
||||||
highlighted,
|
highlighted,
|
||||||
added,
|
added,
|
||||||
@@ -694,7 +693,6 @@ const Transaction = memo(function Transaction(props) {
|
|||||||
hideFraction,
|
hideFraction,
|
||||||
onSave,
|
onSave,
|
||||||
onEdit,
|
onEdit,
|
||||||
onHover,
|
|
||||||
onDelete,
|
onDelete,
|
||||||
onSplit,
|
onSplit,
|
||||||
onManagePayees,
|
onManagePayees,
|
||||||
@@ -804,7 +802,7 @@ const Transaction = memo(function Transaction(props) {
|
|||||||
let isOffBudget = account && account.offbudget === 1;
|
let isOffBudget = account && account.offbudget === 1;
|
||||||
|
|
||||||
let valueStyle = added ? { fontWeight: 600 } : null;
|
let valueStyle = added ? { fontWeight: 600 } : null;
|
||||||
let backgroundFocus = hovered || focusedField === 'select';
|
let backgroundFocus = focusedField === 'select';
|
||||||
let amountStyle = hideFraction ? { letterSpacing: -0.5 } : null;
|
let amountStyle = hideFraction ? { letterSpacing: -0.5 } : null;
|
||||||
|
|
||||||
let statusProps = getStatusProps(notes);
|
let statusProps = getStatusProps(notes);
|
||||||
@@ -820,6 +818,12 @@ const Transaction = memo(function Transaction(props) {
|
|||||||
? theme.tableRowBackgroundHover
|
? theme.tableRowBackgroundHover
|
||||||
: theme.tableBackground,
|
: theme.tableBackground,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
':hover': {
|
||||||
|
backgroundColor: theme.tableRowBackgroundHover,
|
||||||
|
color: theme.tableRowBackgroundHighlightText,
|
||||||
|
},
|
||||||
|
},
|
||||||
highlighted || selected
|
highlighted || selected
|
||||||
? { color: theme.tableRowBackgroundHighlightText }
|
? { color: theme.tableRowBackgroundHighlightText }
|
||||||
: { color: theme.tableText },
|
: { color: theme.tableText },
|
||||||
@@ -830,7 +834,6 @@ const Transaction = memo(function Transaction(props) {
|
|||||||
},
|
},
|
||||||
_unmatched && { opacity: 0.5 },
|
_unmatched && { opacity: 0.5 },
|
||||||
]}
|
]}
|
||||||
onMouseEnter={() => onHover && onHover(transaction.id)}
|
|
||||||
>
|
>
|
||||||
{isChild && (
|
{isChild && (
|
||||||
<Field
|
<Field
|
||||||
@@ -861,7 +864,7 @@ const Transaction = memo(function Transaction(props) {
|
|||||||
isChild ? (
|
isChild ? (
|
||||||
<DeleteCell
|
<DeleteCell
|
||||||
onDelete={() => onDelete && onDelete(transaction.id)}
|
onDelete={() => onDelete && onDelete(transaction.id)}
|
||||||
exposed={hovered || editing}
|
exposed={editing}
|
||||||
style={[isChild && { borderLeftWidth: 1 }, { lineHeight: 0 }]}
|
style={[isChild && { borderLeftWidth: 1 }, { lineHeight: 0 }]}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -870,7 +873,7 @@ const Transaction = memo(function Transaction(props) {
|
|||||||
) : (
|
) : (
|
||||||
<SelectCell
|
<SelectCell
|
||||||
/* Checkmark field for non-child transaction */
|
/* Checkmark field for non-child transaction */
|
||||||
exposed={hovered || selected || editing}
|
exposed={selected || editing}
|
||||||
focused={focusedField === 'select'}
|
focused={focusedField === 'select'}
|
||||||
onSelect={e => {
|
onSelect={e => {
|
||||||
dispatchSelected({ type: 'select', id: transaction.id, event: e });
|
dispatchSelected({ type: 'select', id: transaction.id, event: e });
|
||||||
@@ -1318,7 +1321,6 @@ function NewTransaction({
|
|||||||
categoryGroups,
|
categoryGroups,
|
||||||
payees,
|
payees,
|
||||||
editingTransaction,
|
editingTransaction,
|
||||||
hoveredTransaction,
|
|
||||||
focusedField,
|
focusedField,
|
||||||
showAccount,
|
showAccount,
|
||||||
showCategory,
|
showCategory,
|
||||||
@@ -1326,7 +1328,6 @@ function NewTransaction({
|
|||||||
showCleared,
|
showCleared,
|
||||||
dateFormat,
|
dateFormat,
|
||||||
hideFraction,
|
hideFraction,
|
||||||
onHover,
|
|
||||||
onClose,
|
onClose,
|
||||||
onSplit,
|
onSplit,
|
||||||
onEdit,
|
onEdit,
|
||||||
@@ -1355,13 +1356,12 @@ function NewTransaction({
|
|||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onMouseLeave={() => onHover(null)}
|
|
||||||
>
|
>
|
||||||
{transactions.map((transaction, idx) => (
|
{transactions.map((transaction, idx) => (
|
||||||
<Transaction
|
<Transaction
|
||||||
|
isNew
|
||||||
key={transaction.id}
|
key={transaction.id}
|
||||||
editing={editingTransaction === transaction.id}
|
editing={editingTransaction === transaction.id}
|
||||||
hovered={hoveredTransaction === transaction.id}
|
|
||||||
transaction={transaction}
|
transaction={transaction}
|
||||||
showAccount={showAccount}
|
showAccount={showAccount}
|
||||||
showCategory={showCategory}
|
showCategory={showCategory}
|
||||||
@@ -1375,7 +1375,6 @@ function NewTransaction({
|
|||||||
dateFormat={dateFormat}
|
dateFormat={dateFormat}
|
||||||
hideFraction={hideFraction}
|
hideFraction={hideFraction}
|
||||||
expanded={true}
|
expanded={true}
|
||||||
onHover={onHover}
|
|
||||||
onEdit={onEdit}
|
onEdit={onEdit}
|
||||||
onSave={onSave}
|
onSave={onSave}
|
||||||
onSplit={onSplit}
|
onSplit={onSplit}
|
||||||
@@ -1431,7 +1430,6 @@ function TransactionTableInner({
|
|||||||
dateFormat = 'MM/dd/yyyy',
|
dateFormat = 'MM/dd/yyyy',
|
||||||
newNavigator,
|
newNavigator,
|
||||||
renderEmpty,
|
renderEmpty,
|
||||||
onHover,
|
|
||||||
onScroll,
|
onScroll,
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
@@ -1471,7 +1469,6 @@ function TransactionTableInner({
|
|||||||
const {
|
const {
|
||||||
transactions,
|
transactions,
|
||||||
selectedItems,
|
selectedItems,
|
||||||
hoveredTransaction,
|
|
||||||
accounts,
|
accounts,
|
||||||
categoryGroups,
|
categoryGroups,
|
||||||
payees,
|
payees,
|
||||||
@@ -1487,7 +1484,6 @@ function TransactionTableInner({
|
|||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
let trans = item;
|
let trans = item;
|
||||||
let hovered = hoveredTransaction === trans.id;
|
|
||||||
let selected = selectedItems.has(trans.id);
|
let selected = selectedItems.has(trans.id);
|
||||||
|
|
||||||
let parent = props.transactionMap.get(trans.parent_id);
|
let parent = props.transactionMap.get(trans.parent_id);
|
||||||
@@ -1527,7 +1523,6 @@ function TransactionTableInner({
|
|||||||
showCategory={showCategory}
|
showCategory={showCategory}
|
||||||
showBalance={showBalances}
|
showBalance={showBalances}
|
||||||
showCleared={showCleared}
|
showCleared={showCleared}
|
||||||
hovered={hovered}
|
|
||||||
selected={selected}
|
selected={selected}
|
||||||
highlighted={false}
|
highlighted={false}
|
||||||
added={isNew?.(trans.id)}
|
added={isNew?.(trans.id)}
|
||||||
@@ -1544,7 +1539,6 @@ function TransactionTableInner({
|
|||||||
}
|
}
|
||||||
dateFormat={dateFormat}
|
dateFormat={dateFormat}
|
||||||
hideFraction={hideFraction}
|
hideFraction={hideFraction}
|
||||||
onHover={onHover}
|
|
||||||
onEdit={tableNavigator.onEdit}
|
onEdit={tableNavigator.onEdit}
|
||||||
onSave={props.onSave}
|
onSave={props.onSave}
|
||||||
onDelete={props.onDelete}
|
onDelete={props.onDelete}
|
||||||
@@ -1592,7 +1586,6 @@ function TransactionTableInner({
|
|||||||
<NewTransaction
|
<NewTransaction
|
||||||
transactions={props.newTransactions}
|
transactions={props.newTransactions}
|
||||||
editingTransaction={newNavigator.editingId}
|
editingTransaction={newNavigator.editingId}
|
||||||
hoveredTransaction={props.hoveredTransaction}
|
|
||||||
focusedField={newNavigator.focusedField}
|
focusedField={newNavigator.focusedField}
|
||||||
accounts={props.accounts}
|
accounts={props.accounts}
|
||||||
categoryGroups={props.categoryGroups}
|
categoryGroups={props.categoryGroups}
|
||||||
@@ -1610,7 +1603,6 @@ function TransactionTableInner({
|
|||||||
onEdit={newNavigator.onEdit}
|
onEdit={newNavigator.onEdit}
|
||||||
onSave={props.onSave}
|
onSave={props.onSave}
|
||||||
onDelete={props.onDelete}
|
onDelete={props.onDelete}
|
||||||
onHover={onHover}
|
|
||||||
onManagePayees={props.onManagePayees}
|
onManagePayees={props.onManagePayees}
|
||||||
onCreatePayee={props.onCreatePayee}
|
onCreatePayee={props.onCreatePayee}
|
||||||
onNavigateToTransferAccount={onNavigateToTransferAccount}
|
onNavigateToTransferAccount={onNavigateToTransferAccount}
|
||||||
@@ -1625,7 +1617,6 @@ function TransactionTableInner({
|
|||||||
<View
|
<View
|
||||||
style={[{ flex: 1, overflow: 'hidden' }]}
|
style={[{ flex: 1, overflow: 'hidden' }]}
|
||||||
data-testid="transaction-table"
|
data-testid="transaction-table"
|
||||||
onMouseLeave={() => onHover(null)}
|
|
||||||
>
|
>
|
||||||
<Table
|
<Table
|
||||||
navigator={tableNavigator}
|
navigator={tableNavigator}
|
||||||
@@ -1661,9 +1652,6 @@ function TransactionTableInner({
|
|||||||
|
|
||||||
export let TransactionTable = forwardRef((props, ref) => {
|
export let TransactionTable = forwardRef((props, ref) => {
|
||||||
let [newTransactions, setNewTransactions] = useState(null);
|
let [newTransactions, setNewTransactions] = useState(null);
|
||||||
let [hoveredTransaction, setHoveredTransaction] = useState(
|
|
||||||
props.hoveredTransaction,
|
|
||||||
);
|
|
||||||
let [prevIsAdding, setPrevIsAdding] = useState(false);
|
let [prevIsAdding, setPrevIsAdding] = useState(false);
|
||||||
let splitsExpanded = useSplitsExpanded();
|
let splitsExpanded = useSplitsExpanded();
|
||||||
let prevSplitsExpanded = useRef(null);
|
let prevSplitsExpanded = useRef(null);
|
||||||
@@ -1917,10 +1905,6 @@ export let TransactionTable = forwardRef((props, ref) => {
|
|||||||
[props.onSave],
|
[props.onSave],
|
||||||
);
|
);
|
||||||
|
|
||||||
let onHover = useCallback(id => {
|
|
||||||
setHoveredTransaction(id);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
let onDelete = useCallback(id => {
|
let onDelete = useCallback(id => {
|
||||||
let temporary = isTemporaryId(id);
|
let temporary = isTemporaryId(id);
|
||||||
|
|
||||||
@@ -2014,9 +1998,7 @@ export let TransactionTable = forwardRef((props, ref) => {
|
|||||||
transactions={transactions}
|
transactions={transactions}
|
||||||
transactionMap={transactionMap}
|
transactionMap={transactionMap}
|
||||||
selectedItems={selectedItems}
|
selectedItems={selectedItems}
|
||||||
hoveredTransaction={hoveredTransaction}
|
|
||||||
isExpanded={splitsExpanded.expanded}
|
isExpanded={splitsExpanded.expanded}
|
||||||
onHover={onHover}
|
|
||||||
onSave={onSave}
|
onSave={onSave}
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
onSplit={onSplit}
|
onSplit={onSplit}
|
||||||
|
|||||||
6
upcoming-release-notes/1402.md
Normal file
6
upcoming-release-notes/1402.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
category: Bugfix
|
||||||
|
authors: [biohzrddd]
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix bug where all Account Transaction rows would be re-rendered on hover of a single Transaction row
|
||||||
Reference in New Issue
Block a user