feat(ops): VersionWatcher — toast prompt when a new deploy is live

Client-side polling component mounted in providers.tsx. At mount,
captures the initial commit from /api/version. Every 60s, re-checks.
If commit differs from the captured one → renders a dismissible toast
in the bottom-right offering a hard reload.

Useful because Next.js bundles cache per commit hash → after a deploy
users would otherwise keep running the old client until they manually
refresh. Now they get a discoverable nudge.

Banner UX:
- "Versiune nouă disponibilă: <shortSha> · apasă pentru reîncărcare"
- [Reîncarcă] button (window.location.reload)
- [X] dismiss for current page life
- Tailwind animate-in fade slide-from-bottom

Polling interval 60s is fine for our deploy frequency; cheap (one
GET per minute, ~150 bytes). Cache-busted with cache: "no-store".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude VM
2026-05-18 23:16:18 +03:00
parent 64bccdb4b0
commit 382940112f
2 changed files with 78 additions and 0 deletions
+2
View File
@@ -5,6 +5,7 @@ import { I18nProvider } from '@/core/i18n';
import { StorageProvider } from '@/core/storage';
import { FeatureFlagProvider } from '@/core/feature-flags';
import { AuthProvider } from '@/core/auth';
import { VersionWatcher } from '@/core/version/version-watcher';
import { DEFAULT_FLAGS } from '@/config/flags';
// Ensure module registry is populated
@@ -22,6 +23,7 @@ export function Providers({ children }: ProvidersProps) {
<FeatureFlagProvider flagDefinitions={DEFAULT_FLAGS}>
<AuthProvider>
{children}
<VersionWatcher />
</AuthProvider>
</FeatureFlagProvider>
</StorageProvider>