🐛fix: prevent render error when additional information missing from hardware (#5413)

This commit is contained in:
Faisal Amir 2025-06-21 00:03:04 +07:00 committed by GitHub
parent ec2602307d
commit 0518fea2a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 12 deletions

View File

@ -39,13 +39,7 @@ export const Route = createFileRoute(route.settings.hardware as any)({
component: Hardware,
})
function SortableGPUItem({
gpu,
index,
}: {
gpu: GPU
index: number
}) {
function SortableGPUItem({ gpu, index }: { gpu: GPU; index: number }) {
const {
attributes,
listeners,
@ -105,7 +99,7 @@ function SortableGPUItem({
title={t('settings:hardware.driverVersion')}
actions={
<span className="text-main-view-fg/80">
{gpu.additional_information?.driver_version}
{gpu.additional_information?.driver_version || '-'}
</span>
}
/>
@ -113,7 +107,7 @@ function SortableGPUItem({
title={t('settings:hardware.computeCapability')}
actions={
<span className="text-main-view-fg/80">
{gpu.additional_information?.compute_cap}
{gpu.additional_information?.compute_cap || '-'}
</span>
}
/>
@ -164,7 +158,7 @@ function Hardware() {
}
useEffect(() => {
if (pollingPaused) return;
if (pollingPaused) return
const intervalId = setInterval(() => {
getHardwareInfo().then((data) => {
updateCPUUsage(data.cpu.usage)

View File

@ -252,7 +252,7 @@ function SystemMonitor() {
{t('system-monitor:driverVersion')}
</span>
<span className="text-main-view-fg">
{gpu.additional_information.driver_version}
{gpu.additional_information?.driver_version || '-'}
</span>
</div>
<div className="flex justify-between items-center">
@ -260,7 +260,7 @@ function SystemMonitor() {
{t('system-monitor:computeCapability')}
</span>
<span className="text-main-view-fg">
{gpu.additional_information.compute_cap}
{gpu.additional_information?.compute_cap || '-'}
</span>
</div>
<div className="mt-2">