<p></p>
<p><b>@ghubstan</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/5659#discussion_r689686667">desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBook.java</a>:</p>
<pre style='color:#555'>>                          offer.getId(),
-                        hashOfPayload.getHex());
+                        hashOfPayload == null ? "null" : hashOfPayload.getHex());
+            }
+
+            // The OfferBookListItem with a null or matching payload-hash was not found.
+            // However, when the API's CLI is used to edit and deactivate an offer
+            // in the same command, the edited offer is not re-published (and cannot be
+            // found in local storage).  In this case, we need to remove the deactivated
+            // offer from the list if the local store does not contain an offer with a
+            // matching offerId.
+            if (!isStoredLocally(offer)) {
+                Optional<OfferBookListItem> viewItem = getOfferBookListItem(offer);
+                viewItem.ifPresent((item) -> {
+                    offerBookListItems.remove(item);
</pre>
<blockquote>
<blockquote>
<p>Why is this needed?</p>
</blockquote>
</blockquote>
<p>Short explanation is a stale offer with no matching offer (with id) in local protected storage cannot be taken and should be removed from view.</p>
<blockquote>
<blockquote>
<p>Isn't this just to present it nicely to the UI and that's not a problem when running the cli?</p>
</blockquote>
</blockquote>
<p>The <code>OfferBookListItem</code> is a JFX observable used for display in the OfferBook views.  This code block supports the CLI being able to atomically edit and deactivate an offer in the same <code>editoffer</code> command, something the UI never does.  When you edit an offer with the UI, you deactivate the offer in the 1st mouse click (pencil button), then re-activate it with the confirm-edit or cancel button clicks -- two separate actions that ensure the temporarily deactivated offer is removed from peers, and the edited (or not) offer is re-published to peers (re-activated).</p>
<p>When the CLI edits <em>and</em> deactivates an offer in the same <code>editoffer</code> command, the edited&disabled offer <em>will not be re-published</em> by the API.  On another UI/Peer, the old stale OfferBookListItem would remain (without this code block) in the UI's observable item list because the peer receives on <code>onRemoved</code> msg containing the payload-hash of the newly edited offer the peer never received;  there is no matching payload-hash, and <code>OfferBook.onRemoved(offer, payloadHash)</code> does not know which item to remove.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/5659#discussion_r689686667">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNX7Q44TIE74ZG5T7HDT5E4O3ANCNFSM5B6V23YQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email">Android</a>.<img src="https://github.com/notifications/beacon/AJFFTNWHS7BO5TXCK6MAGPDT5E4O3A5CNFSM5B6V23Y2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOFOINZUI.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/5659#discussion_r689686667",
"url": "https://github.com/bisq-network/bisq/pull/5659#discussion_r689686667",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>