@@ -130,7 +130,6 @@ import androidx.compose.ui.input.key.isShiftPressed
130130import androidx.compose.ui.input.key.key
131131import androidx.compose.ui.input.key.onPreviewKeyEvent
132132import androidx.compose.ui.input.key.type
133−import androidx.compose.ui.layout.onSizeChanged
134133import androidx.compose.ui.platform.LocalContext
135134import androidx.compose.ui.platform.LocalDensity
136135import androidx.compose.ui.platform.LocalHapticFeedback
@@ -1290,28 +1289,18 @@ fun ChatScreen(
12901289 // (the same hazard FileViewScreen's overlay calls out). onSizeChanged only
12911290 // fires while the banner is composed (visible), so gate the inset on
12921291 // bannerVisible and fall back to 44dp until the first measurement arrives.
1293− var bannerHeightPx by remember { mutableIntStateOf(0) }
1294− // Track the search bar height so the list's top padding can grow when search
1295− // is active — otherwise a scrolled-to match lands at index 0, hidden behind
1296− // the floating search bar (the "scroll-under-the-search-bar" bug).
1297− var searchbarHeightPx by remember { mutableIntStateOf(0) }
1298− val density = LocalDensity.current
12991292 val topPad = if (bannerVisible) {
1300− if (bannerHeightPx > 0) {
1301− with(density) { bannerHeightPx.toDp() } + 4.dp
1302− } else {
1303− 44.dp
1304− }
1293+ NetworkConfig.connectionBannerHeightDp.dp + 4.dp
13051294 } else {
13061295 16.dp
1307− } + if (searchActive && searchbarHeightPx > 0) {
1308− with(density) { searchbarHeightPx.toDp() } + 4.dp
1296+ } + if (searchActive) {
1297+ NetworkConfig.chatSearchBarHeightDp.dp + 4.dp
13091298 } else {
13101299 0.dp
13111300 }
13121301 ConnectionBanner(
13131302 state = connectionState,
1314− modifier = Modifier.align(Alignment.TopCenter).onSizeChanged { bannerHeightPx = it.height },
1303+ modifier = Modifier.align(Alignment.TopCenter),
13151304 isOnline = isOnline,
13161305 // On a hard endpoint failure, retry by forcing an SSE reconnect (which
13171306 // re-seeds from REST). refreshMessages is the right recovery path
@@ -1971,8 +1960,7 @@ fun ChatScreen(
19711960 tonalElevation = 3.dp,
19721961 modifier = Modifier
19731962 .padding(horizontal = 12.dp, vertical = 4.dp)
1974− .fillMaxWidth()
1975− .onSizeChanged { searchbarHeightPx = it.height },
1963+ .fillMaxWidth(),
19761964 ) {
19771965 // Focus the search field when the bar appears (from the overflow menu's
19781966 // "Find in conversation" or Ctrl+F), so the user can start typing