Skip to content

Allow reading a nested property from a DeepSignal when there's a nullable object prior to the property #4847

Open
@maxime-cloudnc

Description

@maxime-cloudnc

Which @ngrx/* package(s) are relevant/related to the feature request?

signals

Information

If you create a state containing the following:

object: { value: number };
nullableObject: null | { value: number };
undefinableObject?: { value: number };

You can then do:

store.object.value()

It works just fine as a DeepSignal.

However, both the nullable and potentially undefined ones don't work.

I'm not entirely sure what would be the best option here, either:

store.nullableObject?.value()

But I'm guessing that it may break the reactivity as it may not be caught by the signal graph

OR

store.nullableObject.value()       // returns a type `number | null`
store.undefinableObject.value() // returns a type `number | undefined`

Describe any alternatives/workarounds you're currently using

Reading the top level signal, which isn't ideal ofc as I need another computed down the chain to get reactivity only on one property.

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions