uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

[Reactive] Deprecate State.Empty

Open dr1rrb opened this issue 2 years ago • 1 comments

What would you like to be added:

Deprecate State.Empty

Why is this needed:

This is miss-leading of its behavior when used in VM for 2-way bindings on de-normalized entities, most of the time a State.Value(this, () => new T()) is what user are looking for (cf. https://github.com/unoplatform/uno.extensions/discussions/1163)

For which Platform:

  • [x] iOS
  • [x] Android
  • [x] WebAssembly
  • [x] WebAssembly renders for Xamarin.Forms
  • [x] Windows
  • [ ] Build tasks

Anything else we need to know?

We should also consider the possibility to add a State<T>.SOMETHING(this) when T has a parameter-less constructor. Quid of the right name of this method:

  • Default would be misleading with default(T)
  • Empty would conflict with previous method and introduce a silent breaking change

dr1rrb avatar Feb 17 '23 19:02 dr1rrb

Without State.Empty how would you represent a state that hasn't been set (equivalent of a null value)

nickrandolph avatar Feb 28 '23 04:02 nickrandolph