Open mattmoos opened 3 months ago
@mattmoos Can you provide a PR that adds a test case with your usecase (simplified) that breaks, and we can work on a fix or just use what you recommended (object.hasOwn).
Yes, just had a look at the existing test cases. I think I can provide a test.
I noticed that an initial value of
undefined
cannot be used inderivedFrom
. I think this would be okay in itself because Angular is usingundefined
implicitly as initial value. ButderivedFrom
is settingrequireSync: true
when it detects no initial value, cf. https://github.com/ngxtension/ngxtension-platform/blob/658830c2fa6dc9eaf9f8e813c0509f9d8b5064bf/libs/ngxtension/derived-from/src/derived-from.ts#L112 and that does not work with async observables as sourcesThe problem seems to be here: https://github.com/ngxtension/ngxtension-platform/blob/658830c2fa6dc9eaf9f8e813c0509f9d8b5064bf/libs/ngxtension/derived-from/src/derived-from.ts#L135
derivedFrom
is checkingoptions?.initialValue !== undefined;
, thus an initial value ofundefined
gets lost.I guess this could be fixed by using
Object.hasOwn(options, 'initialValue')
instead?