beancount / fava

Fava - web interface for Beancount
https://beancount.github.io/fava/
MIT License
1.98k stars 288 forks source link

Clearing Transaction Insert Form #1674

Closed yogiparish closed 1 year ago

yogiparish commented 1 year ago

Ive noticed a change in behavior since updating (unfortunately, it's been a while so I can't remember when). Now, when using the '+' form to add a new transaction, fava populates the fields with the last transaction. This is in 90% not the behavior I want.

How can I make it clear all fields? (is there a shortcut to do this, or an option?)

Thanks for any help.

xuhcc commented 1 year ago

The form also doesn't disappear after submission.

I think this bug was introduced in 1.26. The form is still broken in 1.26.1

Beancount version: 2.3.5 Browser: Firefox

fdw commented 1 year ago

I find this bug very annoying, so I dug through the code. It seems to me that the problem was introduced with b46b068b:

entry = entry.constructor(added_entry_date);

In Firefox at least, that throws a class constructors must be invoked with 'new', preventing entry from being overwritten with an empty one and the overlay to be closed.

Previously, there was some more elaborate logic to call new constructors[type](date). I'm not sure what the desired solution is, but I'd be willing to fix it, if you give me a hint 🙂

yagebu commented 1 year ago

Thanks @fdw for investigating and finding the cause! Somewhat embarassing that this bug made it through (but also annoying that Typescript didn't catch it). Adding the "new " should fix it.