File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -20,19 +20,22 @@ export const AppVersionCheck = () => {
2020 ) ;
2121 const { refreshAll, modules } = useModuleBankStore ( ( state ) => state ) ;
2222 useEffect ( ( ) => {
23- if (
24- appVersion != APP_VERSION ||
25- ( appVersion == "development" && TURN_ON_REFRESH )
26- ) {
27- Logger . log ( "Version:" , appVersion , true ) ;
28- Logger . log ( "New version detected, refreshing data..." , true ) ;
29- if ( appVersion != "development" ) {
30- refreshAll ( ) ;
23+ const refresh = async ( ) => {
24+ if (
25+ appVersion != APP_VERSION ||
26+ ( appVersion == "development" && TURN_ON_REFRESH )
27+ ) {
28+ Logger . log ( "Version:" , appVersion , true ) ;
29+ Logger . log ( "New version detected, refreshing data..." , true ) ;
30+ if ( appVersion != "development" ) {
31+ await refreshAll ( ) ;
32+ }
33+ refreshBanners ( ) ;
34+ changeAppVersion ( APP_VERSION ) ;
3135 }
32- refreshBanners ( ) ;
33- changeAppVersion ( APP_VERSION ) ;
34- }
35- updateMultiplePlanner ( modules ) ;
36+ updateMultiplePlanner ( modules ) ;
37+ } ;
38+ refresh ( ) ;
3639 } , [
3740 appVersion ,
3841 refreshAll ,
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import { createJSONStorage, persist } from "zustand/middleware";
44import type { AcademicYear , Banner } from "@/config" ;
55import type { TimetableThemeName } from "@/utils/timetable/colours" ;
66import { APP_CONFIG } from "@/config" ;
7- import { env } from "@/env" ;
87import { Logger } from "@/utils/Logger" ;
98
109export type ISyncRecord = {
@@ -36,7 +35,7 @@ export type ConfigStore = {
3635 matriculationYear : AcademicYear ;
3736 banners : BannerState [ ] ;
3837 warningDismissedTime : number ;
39- appVersion : string ;
38+ appVersion : string | null ;
4039 navigationPopupDismissed : boolean ;
4140} & ConfigAction ;
4241
@@ -57,7 +56,7 @@ export const createConfigBank = (
5756 matriculationYear : defaultAcademicYear ,
5857 banners : defaultBanners ,
5958 warningDismissedTime : Date . now ( ) - 1000 * 60 * 60 * 24 * 7 ,
60- appVersion : env . NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA ,
59+ appVersion : null ,
6160 navigationPopupDismissed : false ,
6261 changeISyncLatestRecord : ( newRecord ) => {
6362 set ( { iSyncLatestRecord : newRecord } ) ;
You can’t perform that action at this time.
0 commit comments