Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Full-stack Signals] Add basic support for NumberSignals #2429

Closed
taefi opened this issue May 15, 2024 · 1 comment · Fixed by #2502 · May be fixed by #2495
Closed

[Full-stack Signals] Add basic support for NumberSignals #2429

taefi opened this issue May 15, 2024 · 1 comment · Fixed by #2502 · May be fixed by #2495

Comments

@taefi
Copy link
Contributor

taefi commented May 15, 2024

Describe your motivation

There should be support for exposing a @BrowserCallable service containing public methods returning a NumberSignal subscription type as follows:

@BrowserCallable
@AnonymousAllowed
public class CounterService {
  private final NumberSignal counter = new NumberSignal(0);

  public NumberSignal counter() {
    return counter;
  }
}

in a way that the necessary TS codes are generated so that the user code can contain usages like this:

import { CounterService } from "Frontend/generated/endpoints";

const counter = CounterService.counter();

export default function CounterView() {
  return <Button onClick={() => counter.increment(1)}>Click count: {counter}</Button>
}

Describe the solution you'd like

N/A

Describe alternatives you've considered

This very first step can ignore as many complexities as possible such as:

  • disconnecting/reconnecting the Websocket connection when moving away from the view of having connection problems
  • having an event queue on the server to resolve the concurrency issues and etc.
  • support for latency compensation

Additional context

The following modules are targeted for adding this feature:

  • TS: react-signals
  • Java: endpoint (under the com.vaadin.hilla.signals)
@taefi taefi added enhancement New feature or request hilla Issues related to Hilla labels May 15, 2024
@taefi taefi changed the title [Fullstack Signals]: Add basic support for NumberSignals [Fullstack Signals] Add basic support for NumberSignals May 15, 2024
@taefi taefi changed the title [Fullstack Signals] Add basic support for NumberSignals [Full-stack Signals] Add basic support for NumberSignals May 15, 2024
@taefi taefi self-assigned this May 21, 2024
taefi added a commit that referenced this issue Jun 3, 2024
taefi added a commit that referenced this issue Jul 26, 2024
* feat: add full stack NumberSignal

Fixes #2429

---------
Co-authored-by: Vlad Rindevich <[email protected]>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Hilla 24.5.0.alpha6 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants