fix: prompt reload for stale Web UI bundle (#641)

This commit is contained in:
Zhicheng Han
2026-05-12 03:03:07 +02:00
committed by GitHub
parent f78fb2da90
commit c36b320e18
13 changed files with 104 additions and 11 deletions
+32
View File
@@ -152,6 +152,38 @@ describe('App Store', () => {
expect(mockSystemApi.updateDefaultModel).not.toHaveBeenCalled()
})
it('marks the client stale when the served Web UI version changes', async () => {
mockSystemApi.checkHealth.mockResolvedValue({
status: 'ok',
webui_version: '0.5.17',
webui_latest: '0.5.17',
webui_update_available: false,
})
const store = useAppStore()
await store.checkConnection()
expect(store.connected).toBe(true)
expect(store.serverVersion).toBe('0.5.17')
expect(store.clientOutdated).toBe(true)
expect(store.updateAvailable).toBe(false)
})
it('does not mark the client stale when the served Web UI version matches this bundle', async () => {
mockSystemApi.checkHealth.mockResolvedValue({
status: 'ok',
webui_version: 'test',
webui_latest: 'test',
webui_update_available: false,
})
const store = useAppStore()
await store.checkConnection()
expect(store.serverVersion).toBe('test')
expect(store.clientOutdated).toBe(false)
})
it('clears the updating state and reports failure when self-update request fails', async () => {
const consoleError = vi.spyOn(console, 'error').mockImplementation(() => {})
mockSystemApi.triggerUpdate.mockRejectedValue(new Error('install failed'))