From a98713481359efab840615fcbc6931d02fdf7a65 Mon Sep 17 00:00:00 2001
From: Oleksandr Karpenko <okarpenko@ebay.com>
Date: Mon, 4 Apr 2016 16:29:09 +0300
Subject: [PATCH] MAGETWO-51293: Fix Ui component insert-form, insert-listing

---
 .../Magento/Ui/view/base/web/js/form/components/insert-form.js  | 2 +-
 .../Ui/view/base/web/js/form/components/insert-listing.js       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/insert-form.js b/app/code/Magento/Ui/view/base/web/js/form/components/insert-form.js
index 790ce2a8cc4..75234253c12 100644
--- a/app/code/Magento/Ui/view/base/web/js/form/components/insert-form.js
+++ b/app/code/Magento/Ui/view/base/web/js/form/components/insert-form.js
@@ -89,7 +89,7 @@ define([
 
         /** @inheritdoc*/
         destroyInserted: function () {
-            if (this.isRendered) {
+            if (this.isRendered && this.externalForm()) {
                 this.externalForm().delegate('destroy');
                 this.removeActions();
                 this.responseStatus(undefined);
diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/insert-listing.js b/app/code/Magento/Ui/view/base/web/js/form/components/insert-listing.js
index f77dcbb71af..eab8b0b8ff3 100644
--- a/app/code/Magento/Ui/view/base/web/js/form/components/insert-listing.js
+++ b/app/code/Magento/Ui/view/base/web/js/form/components/insert-listing.js
@@ -77,7 +77,7 @@ define([
 
         /** @inheritdoc */
         destroyInserted: function () {
-            if (this.isRendered) {
+            if (this.isRendered && this.externalListing()) {
                 this.externalListing().destroy();
             }
 
-- 
GitLab