refactoring (no functionality changes)

This commit is contained in:
henrygd
2025-08-02 17:04:38 -04:00
parent aa2bc9f118
commit a0f271545a
8 changed files with 489 additions and 471 deletions

View File

@@ -18,7 +18,9 @@ export const Home = memo(() => {
const systems = useStore($systems)
const { t } = useLingui()
let alertsKey = ""
/* key to prevent re-rendering of active alerts */
const alertsKey: string[] = []
const activeAlerts = useMemo(() => {
const activeAlerts = alerts.filter((alert) => {
const active = alert.triggered && alert.name in alertInfo
@@ -26,7 +28,7 @@ export const Home = memo(() => {
return false
}
alert.sysname = systems.find((system) => system.id === alert.system)?.name
alertsKey += alert.id
alertsKey.push(alert.id)
return true
})
return activeAlerts
@@ -81,7 +83,7 @@ export const Home = memo(() => {
</div>
</>
),
[alertsKey]
[alertsKey.join("")]
)
})