Skip to content

Commit

Permalink
Safeguard for orderbook duplicated keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang committed Nov 22, 2024
1 parent 574347d commit 6e0e2ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ object DydxReceiptOrderCountView : DydxComponent {
Spacer(modifier = Modifier.weight(0.1f))

PlatformAmountChange(
before = state.before?.let {
before = state.before?.let {
{
Text(
text = state.formatter.localFormatted(it.toDouble(), 0) ?: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ object DydxOrderbookSideView {
}
} else {
item {
Spacer(modifier = Modifier.height(actualLineHeight))
Spacer(modifier = Modifier.height(actualLineHeight).animateItemPlacement())
if (i < numLinesToDisplay - 1) {
Spacer(modifier = Modifier.height(state.displayStyle.spacing))
Spacer(modifier = Modifier.height(state.displayStyle.spacing).animateItemPlacement())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ private fun createViewState(
val items = lines.take(12)
val output: MutableList<DydxOrderbookSideView.DydxOrderbookLine> = mutableListOf()
items.forEach { line ->
if (output.find { it.price == line.price } != null) {
return@forEach
}
val textColor: ThemeColor.SemanticColor
if (colorMap.containsKey(line.price)) {
val entry = colorMap[line.price]!!
Expand Down

0 comments on commit 6e0e2ba

Please sign in to comment.