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
+17 -6
View File
@@ -182,9 +182,10 @@ export function DashboardStoreProvider({
]), ]),
), ),
); );
const selectedDetail = selectedCity const selectedDetail =
? cityDetailsByName[selectedCity] || null selectedCity && proAccess.subscriptionActive
: null; ? cityDetailsByName[selectedCity] || null
: null;
const selectedMarketDate = const selectedMarketDate =
futureModalDate || futureModalDate ||
selectedForecastDate || selectedForecastDate ||
@@ -193,9 +194,10 @@ export function DashboardStoreProvider({
const selectedMarketScanKey = selectedCity const selectedMarketScanKey = selectedCity
? getMarketScanCacheKey(selectedCity, selectedMarketDate) ? getMarketScanCacheKey(selectedCity, selectedMarketDate)
: null; : null;
const selectedMarketScan = selectedCity const selectedMarketScan =
? marketScanByCityName[selectedMarketScanKey || ""] || null selectedCity && proAccess.subscriptionActive
: null; ? marketScanByCityName[selectedMarketScanKey || ""] || null
: null;
useEffect(() => { useEffect(() => {
dashboardClient.writeCityDetailCacheBundle( dashboardClient.writeCityDetailCacheBundle(
@@ -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,