feat: Implement RepeatNode - #14
Merged
Merged
Conversation
wisemuji
requested changes
Jan 2, 2026
wisemuji
left a comment
Contributor
There was a problem hiding this comment.
I have some suggestions & questions!
| val childEvents = child.collectEvents(state.currentTimeMs) | ||
| val nextTime = childEvents | ||
| .maxOfOrNull { it.startTimeMs + it.durationMs } | ||
| ?: state.currentTimeMs |
Contributor
There was a problem hiding this comment.
This logic closely mirrors SequenceNode.collectEvents. If SequenceNode logic is reused or if RepeatNode simply treated its children as an implicit SequenceNode, the code could be DRY-er.
-> This means that test cases will be more concise as well!
-> There's no need to implement this suggestion in the current pull request; it’s just something to keep in mind 🙂
l2hyunwoo
commented
Jan 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
close #10
Description
Implement RepeatNode. This node repeats its children
Ntimes sequentially.Additional Context
What if count is zero or below zero?
count = 0→ Returns empty list (valid: "repeat zero times")count < 0→ ThrowsIllegalArgumentException(fail-fast for logical errors)This follows Compose's implicit contract where invalid indices cause exceptions (e.g., LazyColumn.items(count)).