Skip to content

The documentation or the implementation of chain is incorrect #69330

@jnizet

Description

@jnizet

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

The documentation of the chain function states that it is returning the value of the other resource if it is available, or propagating the status to the current resource if it is not.

But if the other resource is loading, it immediately throws, even if the other resource has a value (which is a possible case when creating a resource that preserves its value while loading, see https://angular.dev/guide/signals/resource#composing-resources-with-snapshots).

So either the documentation is incorrect, or the implementation is. I think the derived resource should keep the behavior of its source regarding the value, so IMHO, it's the implementation that should change.

Moreover, as already noted in #69329, I think the return type of chain should exclude undefined, since it throws when the resource does not have a value, just as hasValue() returning true guarantees that value() does not return undefined.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)


Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecross-cutting: resourceIssues related to the newly introduced resource / httpResourcegemini-triagedLabel noting that an issue has been triaged by gemini

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions