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

cache: Weird behaviour on throw #2006

Closed
ValentinFunk opened this issue Oct 5, 2016 · 4 comments
Closed

cache: Weird behaviour on throw #2006

ValentinFunk opened this issue Oct 5, 2016 · 4 comments

Comments

@ValentinFunk
Copy link

RxJS version: 5.0.0-beta.12

Code to reproduce:

const throwsInstantly = Rx.Observable.throw("E");

throwsInstantly.cache(1).subscribe(
  x => console.log(x),
  error => console.error("Cache", error),
  () => console.log("Done")
);

Example: https://codepen.io/Kamshak-1472390889/pen/gwowkZ?editors=0010#0

Expected behavior: Console prints "Cache E": The error is passed on.

Actual behavior: No output.

Additional information: Is this expected? The behaviour is different if the observable throws after the cache is subscribed (error is passed on).

@benlesh
Copy link
Member

benlesh commented Oct 5, 2016

I think this is a clincher for removing cache until we can further refine the desired behaviors.

@Dorus
Copy link

Dorus commented Oct 5, 2016

This fails for Rx.Observable.throw("E", Rx.Scheduler.queue); but works correct under Rx.Scheduler.asap, Rx.Scheduler.async, Rx.Scheduler.animationFrame and new Rx.TestScheduler().

Also this bug has been introduced between [email protected] and [email protected].

@jayphelps
Copy link
Member

jayphelps commented Oct 12, 2016

@Dorus we ended up removing the .cache() operator for RC1 because in it's current state it was too confusing and [poorly] trying to solve too many problems.

We do plan to revisit in the future and possibly provide one or more operators that have differing forms of caching.

Everyone has differing opinions and use cases for what "caching" should mean and it's far more complex that it may seem at first. Some additional thoughts can be found here.

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants