Closed komritza closed 2 years ago
Doing rebuild
by itself doesn't modify anything; it returns a new instance. So you need to assign it to something. This snippet:
d[action.index]
.deductions
.rebuild((p0) => p0.remove(TravelDeductionType.BREAKFAST));
is throwing away the result; it needs to be something like
_d[action.index].deductions = d[action.index]
.deductions
.rebuild((p0) => p0.remove(TravelDeductionType.BREAKFAST));
there may be others, I didn't check the whole thing carefully, but that should be a start :)
Thanks for fast reply! I still have an issue where
d[action.index].deductions = ....
deductions
is red underlined with the message
There isn’t a setter named 'deductions' in class 'TravelDeduction'.
Try correcting the name to reference an existing setter, or declare the setter.
So I definitely did something wrong.
Then something like
d[action.index] = d[action.index].rebuild((b) => b.deductions = ...)
IT WORKED! This was such a painful thing for me, but I learned a lot on the way! I really appreciate your work!
Great, happy to help :)
State is looking like this:
Trying to update the
days
and to add/remove entry like this:days
looks like this:No matter what I do,
deductions
are always empty even though condition is met. Does someone know what am I missing here? Should I provide additional info so that someone can help out?