diff --git a/desktop/src/main/java/bisq/desktop/main/offer/OfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/OfferView.java index d5b797efc80..dc757f9fe8c 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/OfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/OfferView.java @@ -291,12 +291,15 @@ private void loadCreateViewClass(OfferBookView offerBookView, return; } - View view = viewLoader.load(paymentMethod != null && paymentMethod.isBsqSwap() ? BsqSwapCreateOfferView.class : childViewClass); + View view; // CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times // in different graphs - if (paymentMethod != null && paymentMethod.isBsqSwap()) { + if ((paymentMethod != null && paymentMethod.isBsqSwap()) || + (paymentMethod == null && viewClass.isAssignableFrom(BsqOfferBookView.class))) { + view = viewLoader.load(BsqSwapCreateOfferView.class); ((BsqSwapCreateOfferView) view).initWithData(direction, offerActionHandler, payload); } else { + view = viewLoader.load(childViewClass); ((CreateOfferView) view).initWithData(direction, tradeCurrency, offerActionHandler); } diff --git a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java index e1f34fe8898..b91adb4d56c 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java @@ -296,7 +296,7 @@ else if (!showAllEntry) { abstract void saveSelectedCurrencyCodeInPreferences(OfferDirection direction, String code); - void onSetPaymentMethod(PaymentMethod paymentMethod) { + protected void onSetPaymentMethod(PaymentMethod paymentMethod) { if (paymentMethod == null) return; @@ -613,7 +613,7 @@ private boolean isEditEntry(String id) { return id.equals(GUIUtil.EDIT_FLAG); } - int getNumTrades(Offer offer) { + public int getNumTrades(Offer offer) { return Stream.concat(closedTradableManager.getTradableList().stream(), bsqSwapTradeManager.getTradableList().stream()) .filter(e -> e instanceof Trade || e instanceof BsqSwapTrade) // weed out canceled offers .filter(e -> {