refactor: improve VersionUpgradeModal props and extract ReleaseInfo type

Using useVersionCheck hook in 2 places caused github requests to be made twice, which is not ideal.
This commit is contained in:
Haileyesus
2026-02-05 22:19:15 +03:00
parent 7b498085ea
commit e2e77f20ba
4 changed files with 32 additions and 18 deletions

View File

@@ -1,5 +1,6 @@
import { useState, useEffect } from 'react';
import { version } from '../../package.json';
import { ReleaseInfo } from '../types/sharedTypes';
/**
* Compare two semantic version strings
@@ -20,13 +21,6 @@ const compareVersions = (v1: string, v2: string) => {
return 0;
};
type ReleaseInfo = {
title: string;
body: string;
htmlUrl: string;
publishedAt: string;
};
export const useVersionCheck = (owner: string, repo: string) => {
const [updateAvailable, setUpdateAvailable] = useState(false);
const [latestVersion, setLatestVersion] = useState<string | null>(null);