public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH widget-toolkit] pending object grid: don't fall back to empty string for 0 values
@ 2025-11-17 11:21 Dominik Csapak
  2025-11-17 12:59 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-11-17 11:21 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-17 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-17 11:21 [pve-devel] [PATCH widget-toolkit] pending object grid: don't fall back to empty string for 0 values Dominik Csapak
2025-11-17 12:59 ` [pve-devel] applied: " Thomas Lamprecht

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