Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions src/components/layout/AppVersionCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@ export const AppVersionCheck = () => {
);
const { refreshAll, modules } = useModuleBankStore((state) => state);
useEffect(() => {
if (
appVersion != APP_VERSION ||
(appVersion == "development" && TURN_ON_REFRESH)
) {
Logger.log("Version:", appVersion, true);
Logger.log("New version detected, refreshing data...", true);
if (appVersion != "development") {
refreshAll();
const refresh = async () => {
if (
appVersion != APP_VERSION ||
(appVersion == "development" && TURN_ON_REFRESH)
) {
Logger.log("Version:", appVersion, true);
Logger.log("New version detected, refreshing data...", true);
if (appVersion != "development") {
await refreshAll();
}
refreshBanners();
changeAppVersion(APP_VERSION);
}
refreshBanners();
changeAppVersion(APP_VERSION);
}
updateMultiplePlanner(modules);
updateMultiplePlanner(modules);
};
refresh();
}, [
appVersion,
refreshAll,
Expand Down
5 changes: 2 additions & 3 deletions src/stores/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { createJSONStorage, persist } from "zustand/middleware";
import type { AcademicYear, Banner } from "@/config";
import type { TimetableThemeName } from "@/utils/timetable/colours";
import { APP_CONFIG } from "@/config";
import { env } from "@/env";
import { Logger } from "@/utils/Logger";

export type ISyncRecord = {
Expand Down Expand Up @@ -36,7 +35,7 @@ export type ConfigStore = {
matriculationYear: AcademicYear;
banners: BannerState[];
warningDismissedTime: number;
appVersion: string;
appVersion: string | null;
navigationPopupDismissed: boolean;
} & ConfigAction;

Expand All @@ -57,7 +56,7 @@ export const createConfigBank = (
matriculationYear: defaultAcademicYear,
banners: defaultBanners,
warningDismissedTime: Date.now() - 1000 * 60 * 60 * 24 * 7,
appVersion: env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,
appVersion: null,
navigationPopupDismissed: false,
changeISyncLatestRecord: (newRecord) => {
set({ iSyncLatestRecord: newRecord });
Expand Down