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

When an Observable emits a function #152

Closed
ilikejames opened this issue Jan 4, 2021 · 1 comment · Fixed by #154
Closed

When an Observable emits a function #152

ilikejames opened this issue Jan 4, 2021 · 1 comment · Fixed by #154

Comments

@ilikejames
Copy link

ilikejames commented Jan 4, 2021

Upgrading from @react-rxjs/core@0.2.0 -> @react-rxjs/core@0.5.0 came across this regression.

When an observable returns a function, we get a stringified (plus evaluated!) version of the function. This worked in the prior version.

const counter$ = timer(0, 1000).pipe(startWith(0), shareReplay(1));

const [useBoundMethodThatDoesntWork] = bind(() =>
  counter$.pipe(
    map((count) => {
      return (s) => `${s}: ${count}`;
    })
  )
);

// .....


const method = useBoundMethod();
method('a') // -> Not a function
typeof method // -> 'stirng'
return ({method})
  // -> function (s) { return "".concat(s, ": ").concat(count); }: 0:

Code

@josepot
Copy link
Member

josepot commented Jan 4, 2021

Hi @ilikejames ,

This issue is fixed on 0.6.1. However, we will be publishing a patch for 0.5 shortly and I will add some tests to make sure that this doesn't happen again. Thanks a lot for reporting this!

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 a pull request may close this issue.

2 participants