mirror of
https://github.com/henrygd/beszel.git
synced 2026-04-26 14:31:50 +02:00
hub(ui): small js optimizations
This commit is contained in:
@@ -113,7 +113,7 @@ export default function AreaChartDefault({
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
// if (logRender) {
|
// if (logRender) {
|
||||||
console.log("Rendered at", new Date(), "for", dataPoints?.at(0)?.label)
|
// console.log("Rendered at", new Date(), "for", dataPoints?.at(0)?.label)
|
||||||
// }
|
// }
|
||||||
return (
|
return (
|
||||||
<ChartContainer
|
<ChartContainer
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const App = memo(() => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// change auth store on auth change
|
// change auth store on auth change
|
||||||
pb.authStore.onChange(() => {
|
const unsubscribeAuth = pb.authStore.onChange(() => {
|
||||||
$authenticated.set(pb.authStore.isValid)
|
$authenticated.set(pb.authStore.isValid)
|
||||||
})
|
})
|
||||||
// get general info for authenticated users, such as public key and version
|
// get general info for authenticated users, such as public key and version
|
||||||
@@ -63,6 +63,7 @@ const App = memo(() => {
|
|||||||
// subscribe to new alert updates
|
// subscribe to new alert updates
|
||||||
.then(alertManager.subscribe)
|
.then(alertManager.subscribe)
|
||||||
return () => {
|
return () => {
|
||||||
|
unsubscribeAuth()
|
||||||
alertManager.unsubscribe()
|
alertManager.unsubscribe()
|
||||||
systemsManager.unsubscribe()
|
systemsManager.unsubscribe()
|
||||||
}
|
}
|
||||||
@@ -87,13 +88,12 @@ const Layout = () => {
|
|||||||
const authenticated = useStore($authenticated)
|
const authenticated = useStore($authenticated)
|
||||||
const copyContent = useStore($copyContent)
|
const copyContent = useStore($copyContent)
|
||||||
const direction = useStore($direction)
|
const direction = useStore($direction)
|
||||||
const userSettings = useStore($userSettings)
|
const { layoutWidth } = useStore($userSettings, { keys: ["layoutWidth"] })
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.documentElement.dir = direction
|
document.documentElement.dir = direction
|
||||||
}, [direction])
|
}, [direction])
|
||||||
|
|
||||||
// biome-ignore lint/correctness/useExhaustiveDependencies: only run on mount
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// refresh auth if not authenticated (required for trusted auth header)
|
// refresh auth if not authenticated (required for trusted auth header)
|
||||||
if (!authenticated) {
|
if (!authenticated) {
|
||||||
@@ -113,7 +113,7 @@ const Layout = () => {
|
|||||||
<LoginPage />
|
<LoginPage />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
) : (
|
) : (
|
||||||
<div style={{ "--container": `${userSettings.layoutWidth ?? defaultLayoutWidth}px` } as React.CSSProperties}>
|
<div style={{ "--container": `${layoutWidth ?? defaultLayoutWidth}px` } as React.CSSProperties}>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<Navbar />
|
<Navbar />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user