From 6e64287fefc6c90017601fcc339a84c4a63d1665 Mon Sep 17 00:00:00 2001
From: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date: Thu, 26 Jan 2023 11:02:05 +1000
Subject: [PATCH] =?UTF-8?q?Issue=20#3305706=20by=20znerol,=20SandeepSingh1?=
 =?UTF-8?q?99,=20ivnish,=20smustgrave,=20Spokje,=20=C3=B8kse,=20ranjith=5F?=
 =?UTF-8?q?kumar=5Fk=5Fu,=20coffeemakr,=20DavorHorvacki:=20Uncaught=20Type?=
 =?UTF-8?q?Error:=20this.$pluginSelect.find(...)[0]=20is=20undefined?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(cherry picked from commit d6689fcbdba0209dfdacee53bf519d265e66ba81)
---
 core/modules/field_ui/field_ui.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/modules/field_ui/field_ui.js b/core/modules/field_ui/field_ui.js
index 950df384ca7c..10f5581e50c4 100644
--- a/core/modules/field_ui/field_ui.js
+++ b/core/modules/field_ui/field_ui.js
@@ -365,10 +365,14 @@
       // disabled previously. Pseudo-fields do not have default formatters,
       // we just return to 'visible' for those.
       if (this.region === 'hidden') {
+        const pluginSelect =
+          typeof this.$pluginSelect.find('option')[0] !== 'undefined'
+            ? this.$pluginSelect.find('option')[0].value
+            : undefined;
         const value =
           typeof this.defaultPlugin !== 'undefined'
             ? this.defaultPlugin
-            : this.$pluginSelect.find('option')[0].value;
+            : pluginSelect;
 
         if (typeof value !== 'undefined') {
           if (this.$pluginSelect.length) {
-- 
GitLab