Skip to content

[v2] Native Angular support for client-side fetching using Angular resources #1725

Description

@Joyzyy

Describe the feature

We're migrating a fairly large app to Angular 22 + oPRC v2 and the part that surprised me is that the documented angular path goes through the tanstack-query implementation. However, pulling in tanstack-query, especially for angular, which is in experimental, and the PR updating it for current Angular TanStack/query#10470 has been open since April with no official maintainer review; seems kind of weird, especially since Angular had the resource() api from v20.

What i actually want is for an orpc procedure to be a resource:

readonly wallet = orpcResource(this.api.wallet.getSummary, () => ({ id: this.userId() }));
readonly doctor = orpcResource(this.api.doctors.get, undefined, {
  when: () => this.isDoctor()
});

Whatever the input closure reads is a dependency, so a signal change refetches, and the resource's AbortSignal reaches the transport.

Already built a working version on the .20 beta of the v2, including the parts that have to sit at the link layer rather than in the componet: SSR TransferState for GETs, dev-only guard that rejects non-GET procedure used inside a resource loader and so on. Happy to put it in a public repo you can look through.

Mostly I wnated to ask first whether this is something you'd want here, rather than keeping Angular on the tanstack-query path.

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions