fix: fetch version from API on init instead of using hardcoded value

The version was stuck at "1.0.0" because fetchVersion() was only called
when initialLoad was true, but loadFromCache() set initialLoad to false
before fetchData() ran. Now version is fetched unconditionally in the
global store's init().

Fixes #144

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Badri Narayanan S
2026-01-20 21:42:45 +05:30
parent c8fbf37be9
commit c6a93ec66d
2 changed files with 17 additions and 19 deletions

View File

@@ -30,6 +30,23 @@ document.addEventListener('alpine:init', () => {
this.activeTab = hash;
}
});
// 4. Fetch version from API
this.fetchVersion();
},
async fetchVersion() {
try {
const response = await fetch('/api/config');
if (response.ok) {
const data = await response.json();
if (data.version) {
this.version = data.version;
}
}
} catch (error) {
console.debug('Could not fetch version:', error);
}
},
// App State