Update About Component to Include Connection Status in API Version Fetching

- Modified the About component to check for both token and connection status before fetching API and WebSocket server versions, enhancing the reliability of version retrieval.
- Updated the dependency array in the useEffect hook to include the connection status, ensuring that version fetching reacts appropriately to connection changes.
This commit is contained in:
Tom Butcher 2026-08-23 22:35:11 +01:00
parent c0609cb097
commit 32168be911

View File

@ -29,7 +29,7 @@ const About = () => {
updater: true updater: true
}) })
const { token } = useContext(AuthContext) const { token } = useContext(AuthContext)
const { fetchApiServerVersion, fetchWsServerVersion } = const { fetchApiServerVersion, fetchWsServerVersion, connected } =
useContext(ApiServerContext) useContext(ApiServerContext)
const { isElectron, getAppEngine } = useContext(ElectronContext) const { isElectron, getAppEngine } = useContext(ElectronContext)
const { checkForUpdates } = useContext(AppUpdateContext) const { checkForUpdates } = useContext(AppUpdateContext)
@ -62,7 +62,7 @@ const About = () => {
} }
useEffect(() => { useEffect(() => {
if (token) { if (token && connected) {
fetchApiServerVersion().then((version) => { fetchApiServerVersion().then((version) => {
setApiServerVersion(version) setApiServerVersion(version)
}) })
@ -70,7 +70,7 @@ const About = () => {
setWsServerVersion(version) setWsServerVersion(version)
}) })
} }
}, [fetchApiServerVersion, fetchWsServerVersion, token]) }, [fetchApiServerVersion, fetchWsServerVersion, token, connected])
useEffect(() => { useEffect(() => {
if (!isElectron) return if (!isElectron) return