Skip to content

Add Detail Widget as plugin#690

Open
Joshua-ChiangMai wants to merge 5 commits intomasterfrom
jb/testPluginDetail
Open

Add Detail Widget as plugin#690
Joshua-ChiangMai wants to merge 5 commits intomasterfrom
jb/testPluginDetail

Conversation

@Joshua-ChiangMai
Copy link

migrate Detail Widget as plugin

@github-actions
Copy link
Contributor

Please add one release label:
major (for breaking changes), minor (for new features), patch (for bug fixes) or skip-release (to skip the auto release process).

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

Lighthouse Performance Report

Metrics





📄Full Report
Note: Above values are an average of 3 reports, only the last report was uploaded.

@Joshua-ChiangMai Joshua-ChiangMai added the patch Tag Pull Requests to trigger a patch version update label Feb 12, 2026
@johnny-hausman johnny-hausman self-requested a review February 13, 2026 03:19
Copy link
Collaborator

@johnny-hausman johnny-hausman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I have made some changes to your plugin code. Let me know if you have any additional questions

@Joshua-ChiangMai Joshua-ChiangMai force-pushed the jb/testPluginDetail branch 3 times, most recently from 7ada954 to af57c65 Compare February 14, 2026 13:44
Copy link
Collaborator

@johnny-hausman johnny-hausman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look good!

Have we fixed the display issues you were worried about?

}
val = myVal;
} else {
const items = (val || []).map((value) => {

Check warning

Code scanning / CodeQL

Useless conditional Warning

This use of variable 'val' always evaluates to true.

Copilot Autofix

AI about 15 hours ago

In general, to fix useless conditionals where a variable is always truthy/falsey at a given point, remove the redundant logical operation or rewrite the logic to reflect the true set of possible values. Here, val is already ensured to be a non-empty array when the else branch is executed, because falsy and empty-array cases are caught earlier and converted to "". Thus (val || []) will always evaluate to val, making the || [] part useless. The best fix is to remove the fallback and iterate directly over val.

Concretely, in AppBuilder/platform/plugins/included/view_detail/FNAbviewdetailComponent.js, locate the case "list": handling, in the else block for field.settings.isMultiple !== 0. On line 141, change:

const items = (val || []).map((value) => {

to:

const items = val.map((value) => {

No additional imports, methods, or definitions are needed; this is a localized change that preserves existing functionality while removing the useless conditional.

Suggested changeset 1
AppBuilder/platform/plugins/included/view_detail/FNAbviewdetailComponent.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/AppBuilder/platform/plugins/included/view_detail/FNAbviewdetailComponent.js b/AppBuilder/platform/plugins/included/view_detail/FNAbviewdetailComponent.js
--- a/AppBuilder/platform/plugins/included/view_detail/FNAbviewdetailComponent.js
+++ b/AppBuilder/platform/plugins/included/view_detail/FNAbviewdetailComponent.js
@@ -138,7 +138,7 @@
                         }
                         val = myVal;
                      } else {
-                        const items = (val || []).map((value) => {
+                        const items = val.map((value) => {
                            let myVal = "";
                            (field.settings.options || []).forEach((opt) => {
                               if (opt.id === value.id) myVal = opt.text;
EOF
@@ -138,7 +138,7 @@
}
val = myVal;
} else {
const items = (val || []).map((value) => {
const items = val.map((value) => {
let myVal = "";
(field.settings.options || []).forEach((opt) => {
if (opt.id === value.id) myVal = opt.text;
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed this line of code to "if (!val || (Array.isArray(val) && val.length === 0))".

@Joshua-ChiangMai
Copy link
Author

These look good!

Have we fixed the display issues you were worried about?

I have fixed it(see screenshot). image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Tag Pull Requests to trigger a patch version update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants