fava icon indicating copy to clipboard operation
fava copied to clipboard

Regression in functionality due to storing displayed transaction types in localStorage

Open aronsky opened this issue 3 years ago • 5 comments

I understand the rationale behind the change in the latest version of Fava, that stores the transaction types displayed in the Journal view in localStorage.

However, for certain use-cases, it's a regression in functionality, and I'm wondering whether a workaround is possible. Specifically, in my case, I have a custom link in the left toolbar called Pending, which takes me to a view of the journal with pending transactions only. My importers mark all new transactions pending (!), and every few days, I open Fava, go to my Pending view, and clear those transactions (! -> *). This flow regressed working since the last version, as Fava ignores the show parameter. So, if I viewed the journal with cleared transactions beforehand, they are now shown to me in the Pending view. And conversely, if I manually select to view only pending transactions in the Pending view, next time I go to the journal view, only pending transactions are shown.

Is it possible to make the show parameter override whatever is stored in localStorage? I know it's problematic, because then, if the user changes the displayed transaction types, what state should be modified? I'm open to suggestions.

aronsky avatar Jul 27 '22 06:07 aronsky

I have a similiar workflow but in reverse, I sometimes want to hide all pending transactions - I use them as a marker for whether or not the transaction has cleared with the payment provider/bank.

Instead of using show, I use a custom link with the special /jump handler that sets the filter attribute:

2020-03-03 custom "fava-sidebar-link" "Ignore pending" "/jump?filter=-flag%3A+\"!\""

Clicking this link activates the filter on the current page. Perhaps a workaround for you would be the following setting, which jumps to the journal whilst passing along a filter that shows only pending transactions:

2022-07-27 custom "fava-sidebar-link" "Only pending" "../journal?filter=flag%3A+\"!'\""

I don't think the flag filter is documented anywhere, I honestly forgot where I found it. It's quite likely I had a look in the code.

wylfen avatar Jul 27 '22 07:07 wylfen

Thank you for the suggestion! It does work, but the filter expression remains when I navigate away from the page (which is usually not what I'd want, especially since it filters away most of the transactions in the ledger).

aronsky avatar Jul 27 '22 08:07 aronsky

Yeah, that is something that remains to be fixed with my approach. Sadly I don't think there's a way right now to clear filters automatically by navigating away from a page. I've been resetting it manually...

wylfen avatar Jul 27 '22 10:07 wylfen

+1 on this, I've been using an old version that still leverages query parameters instead of localStorage because of this.

comigor avatar Jan 03 '23 05:01 comigor

Is it possible to make the show parameter override whatever is stored in localStorage?

I think having some specific query parameter, maybe ?set-journal-show=["..."] or ?set=journal-show&value=["..."] to set the localStorage values (on page load) would make sense to have. Combined with the /jump endpoint that should provide a good solution for the given problem. A PR implementing this would be welcome :)

yagebu avatar May 26 '23 16:05 yagebu