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

Update UITableView to track changes precisely #1538

Merged
merged 5 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
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 @@ -49,7 +49,9 @@ internal fun LazyList(
val itemsBefore = remember(state.firstVisibleItemIndex) { (state.firstVisibleItemIndex - OffscreenItemsBufferCount / 2).coerceAtLeast(0) }
val itemsAfter = remember(lastVisibleItemIndex, itemProvider.itemCount) { (itemProvider.itemCount - (lastVisibleItemIndex + OffscreenItemsBufferCount / 2).coerceAtMost(itemProvider.itemCount)).coerceAtLeast(0) }
val scrollItemIndex = remember(state.scrollToItemTriggeredId) { ScrollItemIndex(state.scrollToItemTriggeredId, state.firstVisibleItemIndex) }
var placeholderPoolSize by remember { mutableStateOf(20) }
// TODO(jwilson): drop this down to 20 once this is fixed:
// https://github.com/cashapp/redwood/issues/1551
var placeholderPoolSize by remember { mutableStateOf(30) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a TODO to drop this down to 20 again? It's really just blocked on iOS being unable to request more placeholders.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

  // TODO(jwilson): drop this down to 20 once this is fixed:
  //     https://github.com/cashapp/redwood/issues/1551

LazyList(
isVertical,
itemsBefore = itemsBefore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class LazyListTest {
assertThat(snapshot)
.containsExactly(
DefaultLazyListValue.copy(
placeholder = List(20) { TextValue(Modifier, "Placeholder") },
placeholder = List(30) { TextValue(Modifier, "Placeholder") },
),
)
}
Expand Down Expand Up @@ -91,7 +91,7 @@ class LazyListTest {
.containsExactly(
DefaultLazyListValue.copy(
itemsAfter = expectedItemsAfter,
placeholder = List(20) { TextValue(Modifier, "Placeholder") },
placeholder = List(30) { TextValue(Modifier, "Placeholder") },
items = List(expectedItemCount) { TextValue(Modifier, it.toString()) },
),
)
Expand Down Expand Up @@ -124,7 +124,7 @@ class LazyListTest {
DefaultLazyListValue.copy(
itemsBefore = 35,
itemsAfter = 25,
placeholder = List(20) { TextValue(Modifier, "Placeholder") },
placeholder = List(30) { TextValue(Modifier, "Placeholder") },
items = List(40) { TextValue(Modifier, (it + 35).toString()) },
),
)
Expand Down
Loading