Gate dashboard detail caches behind pro access

This commit is contained in:
2569718930@qq.com
2026-04-08 17:17:51 +08:00
parent 6f80d31852
commit 6c4f9f8203
+13 -2
View File
@@ -182,7 +182,8 @@ export function DashboardStoreProvider({
]), ]),
), ),
); );
const selectedDetail = selectedCity const selectedDetail =
selectedCity && proAccess.subscriptionActive
? cityDetailsByName[selectedCity] || null ? cityDetailsByName[selectedCity] || null
: null; : null;
const selectedMarketDate = const selectedMarketDate =
@@ -193,7 +194,8 @@ export function DashboardStoreProvider({
const selectedMarketScanKey = selectedCity const selectedMarketScanKey = selectedCity
? getMarketScanCacheKey(selectedCity, selectedMarketDate) ? getMarketScanCacheKey(selectedCity, selectedMarketDate)
: null; : null;
const selectedMarketScan = selectedCity const selectedMarketScan =
selectedCity && proAccess.subscriptionActive
? marketScanByCityName[selectedMarketScanKey || ""] || null ? marketScanByCityName[selectedMarketScanKey || ""] || null
: null; : null;
@@ -212,6 +214,15 @@ export function DashboardStoreProvider({
proAccessRef.current = proAccess; proAccessRef.current = proAccess;
}, [proAccess]); }, [proAccess]);
useEffect(() => {
if (proAccess.loading) return;
if (proAccess.authenticated && proAccess.subscriptionActive) return;
dashboardClient.clearCityDetailCache();
setCityDetailsByName({});
setCityDetailMetaByName({});
setMarketScanByCityName({});
}, [proAccess]);
const scheduleBackgroundDetailRefresh = ( const scheduleBackgroundDetailRefresh = (
cityName: string, cityName: string,
cached: CityDetail, cached: CityDetail,