File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,29 @@ import NewProjectView from "./views/new-project/new-project-view";
13
13
import SettingsView from "./views/settings/settings-view" ;
14
14
import useBetterState from "./hooks/useBetterState" ;
15
15
import FirstBoot from "./views/first-boot/first-boot" ;
16
+ import { getVersion } from "@tauri-apps/api/app" ;
17
+ import { TauriRouter } from "./utils/tauri-router" ;
16
18
17
19
function App ( ) {
18
20
const globalContext = useContext ( GlobalContext . Context ) ;
19
21
const isLoading = useBetterState ( true ) ;
20
22
const isFirstBoot = useBetterState ( false ) ;
21
23
22
24
useEffect ( ( ) => {
23
- // window.localStorage.removeItem("pastFirstBoot");
24
- const firstBoot = ! window . localStorage . getItem ( "pastFirstBoot" ) ;
25
+ let version = window . localStorage . getItem ( "app_version" ) ;
26
+ const check = async ( ) => {
27
+ const appVersion = await getVersion ( ) ;
28
+ if ( ! version || appVersion !== version ) {
29
+ TauriRouter . delete_template_cache ( ) ;
30
+ window . localStorage . setItem ( "app_version" , appVersion ) ;
31
+ }
32
+ } ;
33
+ check ( ) ;
34
+ } , [ ] ) ;
35
+
36
+ useEffect ( ( ) => {
37
+ // window.localStorage.removeItem("past_first_boot");
38
+ const firstBoot = ! window . localStorage . getItem ( "past_first_boot" ) ;
25
39
26
40
const load = async ( ) => {
27
41
isFirstBoot . set ( true ) ;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export default function FirstBoot() {
33
33
34
34
function LastStage ( ) {
35
35
useEffect ( ( ) => {
36
- window . localStorage . setItem ( "pastFirstBoot " , "true" ) ;
36
+ window . localStorage . setItem ( "past_first_boot " , "true" ) ;
37
37
window . location . reload ( ) ;
38
38
} , [ ] ) ;
39
39
return null ;
You can’t perform that action at this time.
0 commit comments