* [PATCH proxmox-yew-comp 1/1] key value list: accept objects as data
@ 2026-05-26 16:49 Stefan Hanreich
2026-05-26 20:47 ` applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hanreich @ 2026-05-26 16:49 UTC (permalink / raw)
To: yew-devel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-26 20:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 16:49 [PATCH proxmox-yew-comp 1/1] key value list: accept objects as data Stefan Hanreich
2026-05-26 20:47 ` 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