Skip to content

Conversation

@souzara
Copy link

@souzara souzara commented Jan 24, 2018

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)
Just synchronous transform works in PipeTransform of TableColumn Options.

What is the new behavior?
Added optional feature, if a pipe that returns a Observable in transform method, it's will be subscribed and set value that the observable returns.

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

let transformResult = userPipe.transform(val);
if (transformResult instanceof Observable) {
let observable: Observable<any> = transformResult;
observable.subscribe((transformedValue) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You never unsubscribe from this, I think this would create a memory leak.

Copy link
Author

@souzara souzara Feb 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about something like this:

let pipeSubscription = observable.subscribe((transformedValue) => {
value = transformedValue;
pipeSubscription.unsubscribe();
});

well anyway if observable never call "next" in observer, "pipeSubscription.unsubscribe()" never will be called.

I can add it in a array of subscriptions, then in ngDestroy, we can unsubscribe for all...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants