Current Behavior
When an object that is "array like" and has Observable Symbol, Observable.from uses array like Observable.from mechanism before the Observable Symbol interop.
This is a problem in Microstates because the Observable Symbol provides the proper mechanism to make a Microstate observable. Treating it like an array does something very funky.
Reproduction
const assert = require('assert');
const { from } = require('rxjs');
const Microstates = require('microstates').default;
let ms = Microstates.from([{hello: 'world'}]);
from(ms).subscribe(next => assert(next[0], 'Should have an array with one item'))
Expected behavior
I would expect the Observable Symbol interop to be used before any other.
Environment
Possible Solution
Check for Observable Symbol interop before all other options.
Related https://github.com/microstates/microstates.js/issues/130
I agree. I think this is a bug. If it's not an RxJS Observable, we should check to see if it has the interop point before checking other types. Thanks, @taras.
cc @kwonoj
@benlesh I can create a PR if it helps.
@taras feel freely go for it.
@kwonoj here you go
Most helpful comment
@benlesh I can create a PR if it helps.