fix: KvEditor key 规范化与传输端口往返保留自定义值
- KvEditor 的 key 统一 trim 并去重(保留最后一条):带首尾空白的 key
永远无法被 {{key}} 模板引用,重复 key 只有首条生效
- 切换传输方式仅当当前端口仍是某个默认端口时才跟随切换:
WSS:9443 → TCP → WSS 的往返不再丢失自定义端口
This commit is contained in:
@@ -253,10 +253,17 @@ impl ConnectionForm {
|
||||
if last_transport.get() == idx {
|
||||
return;
|
||||
}
|
||||
// 端口只在仍是某个默认端口(而非用户自定义值)时才跟随切换:
|
||||
// 否则 WSS:9443 → TCP → WSS 的往返会把 9443 静默丢失
|
||||
let current = port_for_sub.read(cx).value().trim().parse::<u16>().ok();
|
||||
let is_default = matches!(current, Some(p) if
|
||||
TransportKind::ALL.iter().any(|k| k.default_port() == p));
|
||||
last_transport.set(idx);
|
||||
port_for_sub.update(cx, |p, cx| {
|
||||
p.set_value(kind.default_port().to_string(), window, cx);
|
||||
});
|
||||
if is_default {
|
||||
port_for_sub.update(cx, |p, cx| {
|
||||
p.set_value(kind.default_port().to_string(), window, cx);
|
||||
});
|
||||
}
|
||||
cx.notify();
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user