Skip to content

Observable-as-store error on reassignment #3304

@kylecordes

Description

@kylecordes

Describe the bug

Reassigning an observable-as-store variable results in an error $$unsubscribe_NAMEHERE is not a function. It appears that currently observables can be used only in certain undocumented restricted ways, perhaps only as long as such variables are never reassigned?

To Reproduce

https://svelte.dev/repl/c73aa3a571844702baa8538c80376603?version=3.6.9

<script>
  import { of } from 'rxjs';

  let myObs = of([1, 2, 3, 4, 5]);
  myObs = of([6, 7, 8, 9, 10]);
</script>

{$myObs}

Expected behavior

Runs without error.

Severity

It's not severe at all if you never use RxJS, but it's a pretty significant restriction if you do (!).

Fixing this seems necessary to declare reasonably observable-as-store support.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions