[Bug]: updating formatting in settings doesn't update sidebar #531

Closed
opened 2026-02-28 19:07:54 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @sidvishnoi on GitHub (Jul 29, 2023).

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

Regression: If you update number formatting in settings, the sidebar doesn't update anymore, without refreshing the page. The transactions in account do use new formatting immediately.

A git bisect pointed to ba2de7ece5. There, I saw use of useMemo in <CellValue/>. From what I understand, useMemo has to take the number format and related settings as a dependency, which I do not know how to fix.

Working before ba2de7ece5 Not working in master

What error did you receive?

No response

Where are you hosting Actual?

Locally via Yarn

What browsers are you seeing the problem on?

Safari

Operating System

Mac OSX

Originally created by @sidvishnoi on GitHub (Jul 29, 2023). ### Verified issue does not already exist? - [X] I have searched and found no existing issue ### What happened? Regression: If you update number formatting in settings, the sidebar doesn't update anymore, without refreshing the page. The transactions in account do use new formatting immediately. A git bisect pointed to ba2de7ece5ae048beb55f96d40bce19a9fd8b718. There, I saw use of `useMemo` in `<CellValue/>`. From what I understand, `useMemo` has to take the number format and related settings as a dependency, which I do not know how to fix. | Working before ba2de7ece5ae048beb55f96d40bce19a9fd8b718 | Not working in master | | --- | --- | | <video src="https://github.com/actualbudget/actual/assets/8426945/77e680d5-e359-46d4-9ea7-a36e92d5fb88"/> | <video src="https://github.com/actualbudget/actual/assets/8426945/afadf1dd-edc7-489e-8a47-f24d37250b4b"/> | ### What error did you receive? _No response_ ### Where are you hosting Actual? Locally via Yarn ### What browsers are you seeing the problem on? Safari ### Operating System Mac OSX
GiteaMirror added the regressionbug labels 2026-02-28 19:07:54 -06:00
Author
Owner

@sidvishnoi commented on GitHub (Jul 29, 2023):

(Discovered this when working on https://github.com/actualbudget/actual/pull/1412)

@sidvishnoi commented on GitHub (Jul 29, 2023): (Discovered this when working on https://github.com/actualbudget/actual/pull/1412)
Author
Owner

@j-f1 commented on GitHub (Jul 29, 2023):

@joel-jeremy can you give some context on why the useMemo was added?

@j-f1 commented on GitHub (Jul 29, 2023): @joel-jeremy can you give some context on why the `useMemo` was added?
Author
Owner

@MatissJanis commented on GitHub (Jul 30, 2023):

Joel's change just highlights the root-cause problem here: we've created a custom state for number formatter that React has no knowledge about. So when this special state changes - React doesn't know to re-render.

We set the state via redux (which is good): https://github.com/actualbudget/actual/blob/master/packages/loot-core/src/shared/util.ts#L205

But we set it as a local state instead of storing it in redux store (which is bad)

And when we get the state - we use a static access method instead of actual redux state selector (which is also bad).

@MatissJanis commented on GitHub (Jul 30, 2023): Joel's change just highlights the root-cause problem here: we've created a custom state for number formatter that React has no knowledge about. So when this special state changes - React doesn't know to re-render. We set the state via redux (which is good): https://github.com/actualbudget/actual/blob/master/packages/loot-core/src/shared/util.ts#L205 But we set it as a local state instead of storing it in redux store (which is bad) And when we get the state - we use a static access method instead of actual redux state selector (which is also bad).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#531