From 0e4fe1b47e6faec0f324abb7f7e94d0b124eda32 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Mon, 8 Jul 2019 16:29:19 -0500 Subject: [PATCH] filter the SelectorProperty source for updates that actually have items; this keeps the currently selected account through server restarts --- src/client/spark/Orders/OrderPropertiesEditorVM.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/spark/Orders/OrderPropertiesEditorVM.cs b/src/client/spark/Orders/OrderPropertiesEditorVM.cs index 122ac1589..81354eae0 100644 --- a/src/client/spark/Orders/OrderPropertiesEditorVM.cs +++ b/src/client/spark/Orders/OrderPropertiesEditorVM.cs @@ -109,9 +109,14 @@ namespace mbts.spark { () => new InlineUserProperty(), new InlineOrderProperties(), DictionaryHelper.empty()); + // Note that with the .Where on the account_tuples, we will ignore any + // updates for which all accounts have been removed. + // This was a safer change than changing SelectorProperty's IEnumberable.OnNext + // so that it would not reset the selected item on server reboots; i.e. this + // change only affects this IObservable. _accounts = backing( nameof(selected_account), - model.factory.subscribe_account_tuples(), + model.factory.subscribe_account_tuples().Where(items => items.Any()), inline_account_src, a => new AccountTuple?(a), () => accounts.Cast().FirstOrDefault(),