Panics · P33 Devtools: handlers in new; stale collection moves, environments and diagram tables change nothing

This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 05:15:49 -04:00
1 parent ffe4f38103
commit 05e846b62a
13 files changed
+220 -215

No files matched your search

+15 -7
View File
@@ -156,8 +156,7 @@ pub fn requests(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
.flex_col()
.gap_4()
.child(
EnvironmentSelector::new("devtools-environments", environments(), environment)
.on_change(move |key, _, cx| change(&chose, cx, |desk| desk.environment = key.clone())),
EnvironmentSelector::new("devtools-environments", environments(), environment, move |key, _, cx| change(&chose, cx, |desk| desk.environment = key.clone())),
)
.child(
div()
@@ -178,7 +177,11 @@ pub fn requests(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
})
})
.on_move(move |key, target, at, _, cx| {
change(&dragged, cx, |desk| desk.collection = moved(&desk.collection, key, target, at))
change(&dragged, cx, |desk| {
if let Some(collection) = moved(&desk.collection, key, target, at) {
desk.collection = collection;
}
})
}),
),
),
@@ -255,8 +258,7 @@ pub fn socket(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
)
.child(
div().w(px(620.)).child(
WebSocketConsole::new("devtools-socket", "wss://stream.example.com/orders", state, messages, &draft, clock)
.on_send(move |text, _, cx| {
WebSocketConsole::new("devtools-socket", "wss://stream.example.com/orders", state, messages, &draft, clock, move |text, _, cx| {
sent.update(cx, |line, cx| {
let at = line.now;
line.messages.push(SocketMessage { direction: Direction::Sent, text, at });
@@ -333,8 +335,14 @@ pub fn graphql(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
fields: vec![("OPEN".into(), "".into()), ("SHIPPED".into(), "".into())],
},
];
let mut explorer = GraphQLExplorer::new("devtools-graphql", types, &query, &variables, &search)
.on_run(move |_, _, _, cx| change(&ran, cx, |graph| graph.answer = Some(ANSWER.into())));
let mut explorer = GraphQLExplorer::new(
"devtools-graphql",
types,
&query,
&variables,
&search,
move |_, _, _, cx| change(&ran, cx, |graph| graph.answer = Some(ANSWER.into())),
);
if let Some(answer) = answer {
explorer = explorer.answer(answer);
}
+2 -5
View File
@@ -270,15 +270,12 @@ pub fn structure(window: &mut Window, cx: &mut App) -> impl IntoElement + use<>
.flex_wrap()
.gap_6()
.child(
div().w(px(660.)).child(TableStructureEditor::new("devtools-structure", fields)
.on_change(move |next, _, cx| change(&edited, cx, |build| build.fields = next)),
div().w(px(660.)).child(TableStructureEditor::new("devtools-structure", fields, move |next, _, cx| change(&edited, cx, |build| build.fields = next)),
),
)
.child(
div().w(px(300.)).child(
IndexManager::new("devtools-indexes", indexes, names)
.on_drop(move |name, _, cx| change(&dropped, cx, |build| build.indexes.retain(|index| index.name != *name)))
.on_create(move |index, _, cx| change(&created, cx, |build| build.indexes.push(index))),
IndexManager::new("devtools-indexes", indexes, names, move |index, _, cx| change(&created, cx, |build| build.indexes.push(index)), move |name, _, cx| change(&dropped, cx, |build| build.indexes.retain(|index| index.name != *name))),
),
),
)
+1 -2
View File
@@ -35,8 +35,7 @@ pub fn text(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
.child(div().w(px(380.)).child(Encoder::new("devtools-encoder", "Hello, 世界")))
.child(
div().w(px(360.)).child(
ColorContrastChecker::new("devtools-contrast", fore, back)
.on_change(move |fore, back, _, cx| change(&colors, cx, |colors| *colors = (fore, back))),
ColorContrastChecker::new("devtools-contrast", fore, back, move |fore, back, _, cx| change(&colors, cx, |colors| *colors = (fore, back))),
),
),
)