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

Crash on expressionProperties if 'templateOptions.options' stream source is a subject #2922

Closed
Greegko opened this issue Jul 9, 2021 · 3 comments
Labels

Comments

@Greegko
Copy link

Greegko commented Jul 9, 2021

Description

For templateOptions.options!

When the observable is interval or from works perfectly, but when we adjust to Subject or BehaviourSubject it crashes, because the JSON.stringify crashes on circular references.

Super short crashing snippet:

expressionProperties: {
  'templateOptions.options': modal => new Subject()
}

When we target other templateOptions like templateOptions.label it is working fine.

Minimal Reproduction

https://stackblitz.com/edit/ngx-formly-observable-options-crash

  • Angular version: stackblitz with 9.x, we use 11.x
  • Formly version: 5.10.21

Find it a nice way to recreate the observable when the target module path value is changing, therefore we would like to use with difference sources and map / filter based on the model actual values.

@Greegko Greegko added the bug label Jul 9, 2021
@kenisteward
Copy link
Collaborator

kenisteward commented Jul 9, 2021 via email

@Greegko
Copy link
Author

Greegko commented Jul 9, 2021

Have you tried returning new Subject().asObservable()?

Sure I am not using pure Subject in general, we are always doing some operations, therefore pipe would create an observable anyway, but even with asObservable it won't change the fact the source is a Subject, just hide the interfaces to emit values. But for fun, tried but doesn't help.

@aitboudad
Copy link
Member

This issue has been fixed and released as part of v5.10.22 release.

Please let us know, in case you are still encountering a similar issue/problem.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants