Skip to content

Commit

Permalink
Use ID as key
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Feb 27, 2025
1 parent 2df1491 commit defa6df
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ function AccountList({

const accountListData = useListData({
initialItems: accounts,
getKey: account => account.id,
});

const { dragAndDropHooks } = useDragAndDrop({
Expand All @@ -332,8 +333,8 @@ function AccountList({
'text/plain': accountListData.getItem(key).id,
})),
onReorder(e) {
const accountIdToMove = accountListData.getItem(e.keys[0]).id;
const targetAccountId = accountListData.getItem(e.target.key).id;
const accountIdToMove = e.keys[0] as AccountEntity['id'];

Check failure on line 336 in packages/desktop-client/src/components/mobile/accounts/Accounts.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Element implicitly has an 'any' type because expression of type '0' can't be used to index type 'Set<Key>'.
const targetAccountId = e.target.key as AccountEntity['id'];

if (e.target.dropPosition === 'before') {
accountListData.moveBefore(e.target.key, e.keys);
Expand Down

0 comments on commit defa6df

Please sign in to comment.