Skip to content

The async generator example in from crashes the browser. #7377

Open
@dpurp-db

Description

@dpurp-db

Describe the bug

Running the async generator example in Stackblitz (link) crashes the page in Chrome v119

https://rxjs.dev/api/index/function/from#examples

Expected behavior

Stackblitz logs the expected outcome:

// Logs:
// 3
// 6
// 12
// 24
// 48
// 96
// 192
// 384
// 768
// 1536

Reproduction code

import { from, take } from 'rxjs';

function* generateDoubles(seed) {
   let i = seed;
   while (true) {
     yield i;
     i = 2 * i; // double it
   }
}

const iterator = generateDoubles(3);
const result = from(iterator).pipe(take(10));

result.subscribe(x => console.log(x));

Reproduction URL

https://stackblitz.com/run?devtoolsheight=50&file=index.ts

Version

7.8.1

Environment

Chrome v119

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions