Skip to content

Add app version fetching and display in WelcomeScreen#235

Merged
abue-ammar merged 4 commits into
athasdev:masterfrom
piotrmaciejbednarski:feature/dynamic-app-version-234
Aug 4, 2025
Merged

Add app version fetching and display in WelcomeScreen#235
abue-ammar merged 4 commits into
athasdev:masterfrom
piotrmaciejbednarski:feature/dynamic-app-version-234

Conversation

@piotrmaciejbednarski

Copy link
Copy Markdown
Contributor

To support project scalability, dynamically load the app version (e.g. in welcome-screen.tsx) instead of hardcoding it. Use getVersion() from the Tauri API (@tauri-apps/api/app) with a fallback to 0.1.0 if it fails. For consistency, put the version-fetching logic in a separate file (src/utils/app-utils.ts). Since getVersion() is async, use a placeholder (...) while loading, it’s unlikely users will notice.

Related Issues

Closes #234

@abue-ammar

Copy link
Copy Markdown
Contributor

i think just app version is fine and in the component put a v before.

@piotrmaciejbednarski

Copy link
Copy Markdown
Contributor Author

i think just app version is fine and in the component put a v before.

The prefix is added in the function inside app-utils.ts:

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";
  }
};

@abue-ammar

Copy link
Copy Markdown
Contributor

i think just app version is fine and in the component put a v before.

The prefix is added in the function inside app-utils.ts:

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

@mehmetozguldev mehmetozguldev self-requested a review August 3, 2025 16:55
@piotrmaciejbednarski

piotrmaciejbednarski commented Aug 3, 2025

Copy link
Copy Markdown
Contributor Author

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

@abue-ammar

Copy link
Copy Markdown
Contributor

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.

Comment thread src/utils/app-utils.ts
@abue-ammar abue-ammar merged commit 30a1649 into athasdev:master Aug 4, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App version in the welcome screen should be loaded dynamically

3 participants