feat(pet): log where the floating pet window actually ended up
The floating pet still does not appear, and the two explanations offered so far are not sufficient. The rebuild path genuinely never called show(), which is fixed and correct on its own reading of the code, but it did not resolve the symptom. A missing Suspense boundary around the lazy pet view looked like a second cause and is not one: removing the wrapper still renders the pet, so React 19 tolerates it. That claim is retracted in the comment rather than left standing. The window is transparent and undecorated, so "did not appear" covers a window placed off-screen, a window that reports hidden, and a window present with nothing painted in it. Log the monitor work area, the position and size after placement, and the visibility the window reports, at default level so no filter is needed to read it. The Suspense wrapper stays. Relying on React tolerating a lazy component with no boundary is not a contract, and the bubble and quick views already have their own. Refs: N-11, F-61. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
这个提交存在于:
父节点
50c75b1105
当前提交
b5e3acbb72
共有 2 个文件被更改,包括 36 次插入 和 3 次删除
|
|
@ -334,10 +334,32 @@ fn reveal_pet_window(app: &AppHandle, window: &tauri::WebviewWindow) -> Result<(
|
||||||
window
|
window
|
||||||
.set_always_on_top(true)
|
.set_always_on_top(true)
|
||||||
.map_err(|error| error.to_string())?;
|
.map_err(|error| error.to_string())?;
|
||||||
if let Some(monitor) = available_monitor_info(app)?.first() {
|
let monitors = available_monitor_info(app)?;
|
||||||
|
if let Some(monitor) = monitors.first() {
|
||||||
place_pet_on_monitor(window, monitor, pet::PetPositionMode::Edge)?;
|
place_pet_on_monitor(window, monitor, pet::PetPositionMode::Edge)?;
|
||||||
}
|
}
|
||||||
window.show().map_err(|error| error.to_string())
|
window.show().map_err(|error| error.to_string())?;
|
||||||
|
|
||||||
|
// At default level on purpose. The window is transparent and undecorated,
|
||||||
|
// so "it did not appear" covers a window placed off-screen, a window that
|
||||||
|
// reports hidden, and a window that is there with nothing painted in it.
|
||||||
|
// Only the first two are visible from here, and they need no log filter to
|
||||||
|
// be worth reading.
|
||||||
|
let position = window.outer_position().ok();
|
||||||
|
let size = window.outer_size().ok();
|
||||||
|
tracing::info!(
|
||||||
|
target: "astrbot::pet",
|
||||||
|
monitors = monitors.len(),
|
||||||
|
monitor_work_area = monitors.first().map(|m| format!(
|
||||||
|
"{}x{}+{}+{}",
|
||||||
|
m.work_width, m.work_height, m.work_left, m.work_top
|
||||||
|
)).unwrap_or_else(|| "<none>".into()).as_str(),
|
||||||
|
position = position.map(|p| format!("{},{}", p.x, p.y)).unwrap_or_else(|| "<unknown>".into()).as_str(),
|
||||||
|
size = size.map(|s| format!("{}x{}", s.width, s.height)).unwrap_or_else(|| "<unknown>".into()).as_str(),
|
||||||
|
visible = window.is_visible().unwrap_or(false),
|
||||||
|
"pet window revealed"
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
|
|
||||||
13
src/App.tsx
13
src/App.tsx
|
|
@ -130,7 +130,18 @@ export function App() {
|
||||||
}, [isBubbleView, isPetView, isQuickView, petDisplayMode]);
|
}, [isBubbleView, isPetView, isQuickView, petDisplayMode]);
|
||||||
|
|
||||||
if (isBubbleView) return <StatusBubble />;
|
if (isBubbleView) return <StatusBubble />;
|
||||||
if (isPetView) return <DesktopPetView />;
|
// `DesktopPetView` is lazy and this branch returns before the shell's own
|
||||||
|
// boundary, so it had none. React 19 turned out to tolerate that — removing
|
||||||
|
// this wrapper still rendered the pet — so it is not the reason the floating
|
||||||
|
// pet does not appear. Kept because relying on that tolerance is not a
|
||||||
|
// contract, and the bubble and quick views already have their own.
|
||||||
|
if (isPetView) {
|
||||||
|
return (
|
||||||
|
<Suspense fallback={null}>
|
||||||
|
<DesktopPetView />
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
}
|
||||||
if (isQuickView) {
|
if (isQuickView) {
|
||||||
return (
|
return (
|
||||||
<main className="quick-app-shell">
|
<main className="quick-app-shell">
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用