Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4ba4805

Browse files
committed
Improve version checking mechanism with better cache and settings preservation
1 parent6bf62a5 commit4ba4805

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

‎client/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name":"exploit-seek",
33
"private":true,
4-
"version":"1.2.0",
4+
"version":"1.2.1",
55
"type":"module",
66
"scripts": {
77
"dev":"vite --host",

‎client/src/main.jsx‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,37 @@ import "./index.css";
66
// Version checking function
77
constcheckVersion=()=>{
88
constcurrentVersion=__APP_VERSION__;
9-
constlastVersion=localStorage.getItem('app_version');
9+
constlastVersion=localStorage.getItem("app_version");
1010

1111
if(lastVersion!==currentVersion){
12-
localStorage.setItem('app_version',currentVersion);
13-
// Clear cache and reload if version changed
14-
if('caches'inwindow){
12+
console.log(
13+
`App version changed from${lastVersion} to${currentVersion}, clearing cache...`
14+
);
15+
16+
// Save important settings
17+
constlanguage=localStorage.getItem("language");
18+
constmode=localStorage.getItem("mode");
19+
20+
// Clear all storage
21+
localStorage.clear();
22+
23+
// Restore important settings
24+
if(language)localStorage.setItem("language",language);
25+
if(mode)localStorage.setItem("mode",mode);
26+
27+
// Set new version
28+
localStorage.setItem("app_version",currentVersion);
29+
30+
// Clear cache
31+
if("caches"inwindow){
1532
caches.keys().then((names)=>{
16-
names.forEach(name=>{
33+
names.forEach((name)=>{
1734
caches.delete(name);
1835
});
1936
});
2037
}
38+
39+
// Force reload from server
2140
window.location.reload(true);
2241
}
2342
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp