Add app version fetching and display in WelcomeScreen#235
Conversation
|
i think just app version is fine and in the component put a v before. |
The prefix is added in the function inside export const fetchAppVersion = async (): Promise<string> => {
try {
const version = await getVersion();
return `v${version}`;
} catch (error) {
console.error("Failed to fetch app version:", error);
// Return default version if fetching fails
return "v0.1.0";
}
}; |
fetchRawAppVersion() that one is better |
|
It really depends on what you want to receive, but in the future fetching the version (probably) will be used in many places so I kept two implementations |
yes that's why. returning just the version code would be better. because most of the cases you won't need the "v". so just use 1 function that returns just the code. less code for a simple thing i believe. |
To support project scalability, dynamically load the app version (e.g. in
welcome-screen.tsx) instead of hardcoding it. UsegetVersion()from the Tauri API (@tauri-apps/api/app) with a fallback to0.1.0if it fails. For consistency, put the version-fetching logic in a separate file (src/utils/app-utils.ts). SincegetVersion()is async, use a placeholder (...) while loading, it’s unlikely users will notice.Related Issues
Closes #234