[GH-ISSUE #2264] [Bug]: Import does not properly set the account sort_order database columns #7827

Closed
opened 2026-04-10 17:50:59 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @joel-jeremy on GitHub (Jan 21, 2024).
Original GitHub issue: https://github.com/actualbudget/actual/issues/2264

Verified issue does not already exist?

  • I have searched and found no existing issue
  • I have checked my server logs and could not see any errors there
  • I will be attaching my server logs to this issue
  • I will be attaching my client-side (browser) logs to this issue
  • I understand that this issue will be automatically closed if insufficient information is provided

What happened?

When importing a file / creating a test budget, the created accounts will have the same sort_order value in the database. This breaks the sorting functionality.

Steps to reproduce:

  1. Import a file / Create a test budget
  2. In the accounts sidebar, drag the first account and switch it with the second account
  3. The first account goes to the bottom of the accounts

This issue does is not present when a user creates a new budget, manually adds accounts and reorders the accounts.

What error did you receive?

No response

Where are you hosting Actual?

Fly.io

What browsers are you seeing the problem on?

Chrome, Other

Operating System

Mobile Device

Originally created by @joel-jeremy on GitHub (Jan 21, 2024). Original GitHub issue: https://github.com/actualbudget/actual/issues/2264 ### Verified issue does not already exist? - [X] I have searched and found no existing issue ### Is this related to GoCardless, Simplefin or another bank-sync provider? - [ ] I have checked my server logs and could not see any errors there - [ ] I will be attaching my server logs to this issue - [ ] I will be attaching my client-side (browser) logs to this issue - [ ] I understand that this issue will be automatically closed if insufficient information is provided ### What happened? When importing a file / creating a test budget, the created accounts will have the same `sort_order` value in the database. This breaks the sorting functionality. Steps to reproduce: 1. Import a file / Create a test budget 2. In the accounts sidebar, drag the first account and switch it with the second account 3. The first account goes to the bottom of the accounts This issue does is not present when a user creates a new budget, manually adds accounts and reorders the accounts. ### What error did you receive? _No response_ ### Where are you hosting Actual? Fly.io ### What browsers are you seeing the problem on? Chrome, Other ### Operating System Mobile Device
GiteaMirror added the bug label 2026-04-10 17:50:59 -05:00
Author
Owner

@youngcw commented on GitHub (Jan 21, 2024):

It looks like the nynab importer gives unique sort values on import. It may just be the demo that they all have the same value

<!-- gh-comment-id:1902736125 --> @youngcw commented on GitHub (Jan 21, 2024): It looks like the nynab importer gives unique sort values on import. It may just be the demo that they all have the same value
Author
Owner

@youngcw commented on GitHub (Jan 24, 2024):

Ive been digging into this a bit. I haven't found out why the demo is different than a ynab import, but this function does the real work. It seems like, for some reason, that when creating a demo budget this function cant ever see that there were accounts previously made in order to properly request a higher sort_order value, so all the accounts in the demo get the same one.

packages/loot-core/src/server/db/index.ts#insert-account

<!-- gh-comment-id:1908556587 --> @youngcw commented on GitHub (Jan 24, 2024): Ive been digging into this a bit. I haven't found out why the demo is different than a ynab import, but this function does the real work. It seems like, for some reason, that when creating a demo budget this function cant ever see that there were accounts previously made in order to properly request a higher sort_order value, so all the accounts in the demo get the same one. packages/loot-core/src/server/db/index.ts#insert-account
Author
Owner

@youngcw commented on GitHub (Jan 24, 2024):

I think I found the problem. Ill put in a PR

<!-- gh-comment-id:1908593890 --> @youngcw commented on GitHub (Jan 24, 2024): I think I found the problem. Ill put in a PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#7827