Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show TimeLane even if the visibleItemsInfo is empty #904

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ fun TimeLane(
content: @Composable (DurationTime) -> Unit,
) {
var currentDurationTime: DurationTime? = null

if (visibleItemsInfo.value.isEmpty()) {
Copy link
Author

Choose a reason for hiding this comment

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

For reviewer:
The original cause of missing TimeLane in the preview was: the preview is a preview, and the scroll does not happen, so visibleItemsInfo is empty.
This should fix the original problem of missing TimeLane in the Preview screenshot tests and should not break the product but it is open to the argument if we have to put the code for the test. If you think it better to avoid placing the code for testing, you'd better update the expected screenshot in the test.

// For preview
val durationTime = timetable[0].first
Box(
modifier = modifier.offset {
IntOffset(
x = 0,
y = 0,
)
}
) {
content(durationTime)
}
return
}

visibleItemIndices.forEachIndexed { relativeIndex, absoluteIndex ->
val durationTime = timetable[absoluteIndex].first
if (currentDurationTime != durationTime) {
Expand Down