Skip to content

Refactor index generator to class that exposes progress - #888

Merged
robbevp merged 2 commits into
mainfrom
refactor/index-generator-context
Oct 31, 2026
Merged

robbevp merged 2 commits into
mainfrom
refactor/index-generator-context

Conversation

@robbevp

@robbevp robbevp commented Oct 24, 2026

Copy link
Copy Markdown
Member

While working on accentor/web#1596, I wanted to be able to know the progress of the index action. We can currently only call next() and just know when it is done.

I refactored our indexGenerator function to an IndexGenerator class that responds to next() with the same value as before, but also allows access to totalPages, currentPage and progress. (Though this technically isn't a JS generator, I looked into declaring this class with class IndexGenerator implements AsyncGenerator, but then I also needed to implement throw() and return(), these methods IMHO don't make a lot of sense in our context)

This probably requires some changes to types in TS projects, but functionally should be the same

@robbevp robbevp self-assigned this Oct 24, 2026
@robbevp
robbevp requested a review from chvp as a code owner October 24, 2026 15:08
@robbevp robbevp added the refactor Internal changes to code structure label Oct 24, 2026

@chvp chvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just one small question.

Comment thread src/http.ts Resolved
@robbevp
robbevp enabled auto-merge (squash) October 31, 2026 12:20
@robbevp
robbevp merged commit e2ae69e into main Oct 31, 2026
4 checks passed
@robbevp
robbevp deleted the refactor/index-generator-context branch October 31, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Internal changes to code structure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants