From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D66691FF146 for ; Tue, 26 May 2026 18:49:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9D5C36F36; Tue, 26 May 2026 18:49:21 +0200 (CEST) From: Stefan Hanreich 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 Message-ID: <20260526164903.618112-1-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779814133101 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.600 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: YMDWUIWDZ3XFVDOMCY5N2BSUDPYAB3G3 X-Message-ID-Hash: YMDWUIWDZ3XFVDOMCY5N2BSUDPYAB3G3 X-MailFrom: s.hanreich@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: When setting the value, convert any objects into a list of (String, Value) pairs and then set the data. Signed-off-by: Stefan Hanreich --- 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::>(value.clone()).unwrap(); self.set_data(&data); -- 2.47.3