public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit] pending object grid: don't fall back to empty string for 0 values
Date: Mon, 17 Nov 2025 12:21:00 +0100	[thread overview]
Message-ID: <20251117112213.1387848-1-d.csapak@proxmox.com> (raw)

if we have a value that is set to `0` (the number, not the string),
the default pending object grid renderer would overwrite that with the
empty string, since `0` does not evaluate to true.

Instead, use the `Nullish coalescing operator` (??) to overwrite the
value with only when it's null or undefined.

This fixes an issue with the rendering if the `TTY Count` in PVE is set
to 0. (There are no other options where this could happen currently,
because they either have a custom renderer, or do not allow 0 as value).

Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
this replaces the first half of this patch:
https://lore.proxmox.com/pve-devel/20251117092110.628324-1-d.csapak@proxmox.com/

 src/grid/PendingObjectGrid.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/grid/PendingObjectGrid.js b/src/grid/PendingObjectGrid.js
index 6898717..c138713 100644
--- a/src/grid/PendingObjectGrid.js
+++ b/src/grid/PendingObjectGrid.js
@@ -74,7 +74,7 @@ Ext.define('Proxmox.grid.PendingObjectGrid', {
                 pending = undefined;
             }
         } else {
-            current = value || '';
+            current = value ?? '';
             pending = record.data.pending;
         }
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-11-17 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 11:21 Dominik Csapak [this message]
2025-11-17 12:59 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251117112213.1387848-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal