public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH proxmox-yew-comp 1/1] key value list: accept objects as data
Date: Tue, 26 May 2026 18:49:02 +0200	[thread overview]
Message-ID: <20260526164903.618112-1-s.hanreich@proxmox.com> (raw)

When setting the value, convert any objects into a list of (String,
Value) pairs and then set the data.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---

Notes:
    Not sure about this change, but accepting objects seems reasonable
    here? Probably good if someone with more clue about the component can
    chime in. Fixes the issue with resetting the prepared answer form for
    me.

 src/key_value_list.rs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/key_value_list.rs b/src/key_value_list.rs
index e6377b8..f579b04 100644
--- a/src/key_value_list.rs
+++ b/src/key_value_list.rs
@@ -242,6 +242,14 @@ impl ManagedField for KeyValueListField {
                         .unwrap();
                 self.set_data(&data);
             }
+            Value::Object(map) => {
+                let values: Vec<(String, Value)> = map
+                    .iter()
+                    .map(|(key, value)| (key.clone(), value.clone()))
+                    .collect();
+
+                self.set_data(&values);
+            }
             value => {
                 let data = serde_json::from_value::<Vec<(String, Value)>>(value.clone()).unwrap();
                 self.set_data(&data);
-- 
2.47.3





             reply	other threads:[~2026-05-26 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 16:49 Stefan Hanreich [this message]
2026-05-26 20:47 ` applied: [PATCH proxmox-yew-comp 1/1] key value list: accept objects as data 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=20260526164903.618112-1-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=yew-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