Do not store values in Drivers/views
I think it would help avoiding stale/zombie children issues if the only source of data was the store.
Currently the drivers return a view (https://framagit.org/kresusapp/kresus/-/blob/main/client/components/drivers/currency.tsx#L73) storing its own content.
The current view is then updated on each change to state.banks
: https://framagit.org/kresusapp/kresus/-/blob/main/client/main.tsx#L121.
Each driver should instead return selectors to get:
- transactions ids
- transactions (do we still need it? Cannot we derive it from the transactions?)
- lastCheckDate
- balance
- outstandingSum
- initialBalance
Plus the current methods (without change):
- formatCurrency: no change
Since at the moment those properties are computed on each state.banks
change, I feel like memoizing the selectors based on state.banks
should be enough, but it could even be improved by driver/method.
useMemo
cannot be used AFAIK since it is not in a render method but other memoizing methods can be used.