Skip to content

Commit d1f11f2

Browse files
authored
fix: check isMaximized, warning tooltip, unreliable isToolhiveRunning and log severity (#907)
* fix: skip isMaximized if main window is not valid * refactor: change from error to to info dor thv stderr * fix: add staleTime 0 for thv running check * fix: Tooltip was changing from controlled to uncontrolled
1 parent d95b194 commit d1f11f2

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

main/src/main-window.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ export function toggleMaximizeMainWindow(): void {
308308
*/
309309
export function isMainWindowMaximized(): boolean {
310310
try {
311-
return mainWindow?.isMaximized() ?? false
311+
if (!isMainWindowValid()) {
312+
return false
313+
}
314+
return mainWindow!.isMaximized()
312315
} catch (error) {
313316
log.error('Failed to check if window is maximized:', error)
314317
return false

main/src/toolhive-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export async function startToolhive(tray?: Tray): Promise<void> {
154154
if (output.includes('A new version of ToolHive is available')) {
155155
return
156156
}
157-
log.error(`[ToolHive stderr] ${output}`)
157+
log.info(`[ToolHive stderr] ${output}`)
158158
scope.addBreadcrumb({
159159
category: 'debug',
160160
message: `[ToolHive stderr] ${output}`,

renderer/src/common/components/ui/tooltip.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,19 @@ function Tooltip({ onlyWhenTruncated = false, ...props }: TooltipProps) {
3535
[onlyWhenTruncated]
3636
)
3737

38-
const effectiveOpen = onlyWhenTruncated
39-
? // if not truncated, force closed; otherwise respect consumer control
40-
isTruncated
41-
? props.open
42-
: false
43-
: props.open
38+
const effectiveOpen = React.useMemo(() => {
39+
if (!onlyWhenTruncated) {
40+
return props.open
41+
}
42+
43+
// When onlyWhenTruncated is enabled, only show tooltip if text is truncated
44+
if (!isTruncated) {
45+
return false
46+
}
47+
48+
// Text is truncated, respect consumer control or default to false
49+
return props.open ?? false
50+
}, [onlyWhenTruncated, isTruncated, props.open])
4451

4552
return (
4653
<TooltipProvider>

renderer/src/routes/__root.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const Route = createRootRouteWithContext<{
100100
},
101101
retry: 3,
102102
retryDelay: 300,
103+
staleTime: 0,
103104
})
104105
try {
105106
await queryClient.ensureQueryData({

0 commit comments

Comments
 (0)