shared-signals.adoc: Replace ValueSignal with SharedValueSignal#5635
shared-signals.adoc: Replace ValueSignal with SharedValueSignal#5635DarioViva42 wants to merge 1 commit into
Conversation
This documentation describes the usage of Shared Signals. So it is really confusing and probably a mistake, that in some of the examples Local Signals are used.
|
|
|
Also what I also find pretty Strange that there is a Shared Signal Also we get the following error:
Beforehand this code worked. We had two Signals that we created with the Where should such questions be asked. On some documentation pages you can comment. Like https://vaadin.com/docs/latest/components/avatar. But on the documentation https://vaadin.com/docs/latest/flow/ui-state/shared-signals this does not work, which is kind of strange. |
|
Thank you for pointing out the inconsistency in the documentation! At the same time, the correct fix isn't as easy as just replacing
There's no need for a dedicated local signal type for numbers. You can just as well use
This was one of the main reasons we decided to introduce the split between "local" and "shared" signals. The shared signals are designed to eventually support synchronizing state across a cluster. One of the trade-offs in that case is that different signals might be "owned" by different nodes in that cluster which means that it's not possible to have an atomic transaction that covers both of them. You can force both signals to be "owned" by the same node by creating them as child signals of the same root signal: SharedNodeSignal root = new SharedNodeSignal();
ValueSignal<String> first = root.insertChildWithValue("first", ListPosition.last()).signal().asValue(String.class);
ValueSignal<String> second = root.insertChildWithValue("second", ListPosition.last()).signal().asValue(String.class);It's now possible to use both
That's a configuration issue on our side. Thanks for pointing out. In general, the kinds of questions you present here are still more appropriate for our discussion forum at https://vaadin.com/forum/. |
|
I created #5636 for revising the whole structure of the documentation related to shared signal. |
|
@Legioth Small correction in your code snippet: SharedNodeSignal root = new SharedNodeSignal();
SharedValueSignal<String> first = root.insertChildWithValue("first", ListPosition.last()).signal().asValue(String.class);
SharedValueSignal<String> second = root.insertChildWithValue("second", ListPosition.last()).signal().asValue(String.class);This might be confusing for others reading this in the future. But asValue returns |
|
I have also added an new forum entry. The code that used to work still does not, but I get another exception now. |
This documentation describes the usage of Shared Signals. So it is really confusing and probably a mistake, that in some of the examples Local Signals are used.