Skip to content

Commit e8f8f91

Browse files
committed
fix results
1 parent 2793b82 commit e8f8f91

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

public/version.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": "1.0.1",
3+
"buildTime": "2025-12-26T22:46:00Z"
4+
}

src/app/evalbars/App.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,32 @@ function App() {
101101
const [lastBlunderTime, setLastBlunderTime] = useState(0);
102102
const blunderCooldown = 10000; // 10 seconds cooldown between blunders
103103

104+
// Auto-reload when new version is deployed
105+
const currentVersion = useRef(null);
106+
useEffect(() => {
107+
const checkVersion = async () => {
108+
try {
109+
const response = await fetch('/version.json?t=' + Date.now(), { cache: 'no-store' });
110+
if (response.ok) {
111+
const data = await response.json();
112+
if (currentVersion.current === null) {
113+
currentVersion.current = data.version;
114+
console.log('App version:', data.version);
115+
} else if (currentVersion.current !== data.version) {
116+
console.log('New version detected, reloading...', data.version);
117+
window.location.reload(true);
118+
}
119+
}
120+
} catch (error) {
121+
console.log('Version check failed:', error);
122+
}
123+
};
124+
125+
checkVersion(); // Check immediately on load
126+
const interval = setInterval(checkVersion, 60000); // Check every 60 seconds
127+
return () => clearInterval(interval);
128+
}, []);
129+
104130
const handleBlunder = (linkIndex) => {
105131
const currentTime = Date.now();
106132
if (!isGameDataLoaded || currentTime - lastBlunderTime < blunderCooldown) {

0 commit comments

Comments
 (0)