알림삭제 오류 수정
This commit is contained in:
@@ -1927,7 +1927,7 @@ function App() {
|
|||||||
markets={monitoredMarkets}
|
markets={monitoredMarkets}
|
||||||
marketSubscriptions={liveStompSubscriptions}
|
marketSubscriptions={liveStompSubscriptions}
|
||||||
activeMarket={symbol}
|
activeMarket={symbol}
|
||||||
enabled={formalLogin && monitoredMarkets.length > 0}
|
enabled={formalLogin && monitoredMarkets.length > 0 && appSettingsLoaded}
|
||||||
popupEnabled={appDefaults.tradeAlertPopup ?? true}
|
popupEnabled={appDefaults.tradeAlertPopup ?? true}
|
||||||
chartMarkersActive={menuPage === 'chart'}
|
chartMarkersActive={menuPage === 'chart'}
|
||||||
onMarkersChange={markers => {
|
onMarkersChange={markers => {
|
||||||
|
|||||||
@@ -79,6 +79,14 @@ export function getAppSettingsCache(): AppSettingsDto {
|
|||||||
return _cache ?? {};
|
return _cache ?? {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 낙관적 캐시 패치 — _cache 가 null 일 때도 다음 로드 전까지 임시 보관 */
|
||||||
|
export function patchAppSettingsCache(patch: Partial<AppSettingsDto>): void {
|
||||||
|
if (_cache !== null) {
|
||||||
|
Object.assign(_cache, patch);
|
||||||
|
}
|
||||||
|
// _cache 가 null 이면 현재 로드 중이므로 건너뜀 (로드 완료 후 DB 저장값으로 덮어씌워짐)
|
||||||
|
}
|
||||||
|
|
||||||
export function subscribeAppSettings(listener: AppSettingsListener): () => void {
|
export function subscribeAppSettings(listener: AppSettingsListener): () => void {
|
||||||
_listeners.add(listener);
|
_listeners.add(listener);
|
||||||
return () => _listeners.delete(listener);
|
return () => _listeners.delete(listener);
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
getAppSettingsCache,
|
getAppSettingsCache,
|
||||||
|
patchAppSettingsCache,
|
||||||
subscribeAppSettings,
|
subscribeAppSettings,
|
||||||
} from '../hooks/useAppSettings';
|
} from '../hooks/useAppSettings';
|
||||||
import { saveAppSettings, type AppSettingsDto } from './backendApi';
|
import { saveAppSettings } from './backendApi';
|
||||||
import {
|
import {
|
||||||
EMPTY_UI_PREFERENCES,
|
EMPTY_UI_PREFERENCES,
|
||||||
UI_PREFERENCES_VERSION,
|
UI_PREFERENCES_VERSION,
|
||||||
@@ -64,9 +65,7 @@ export function patchUiPreferences(patch: Partial<UiPreferences>, immediate = fa
|
|||||||
const next = deepMerge(current as Record<string, unknown>, patch as Record<string, unknown>) as UiPreferences;
|
const next = deepMerge(current as Record<string, unknown>, patch as Record<string, unknown>) as UiPreferences;
|
||||||
next.v = UI_PREFERENCES_VERSION;
|
next.v = UI_PREFERENCES_VERSION;
|
||||||
|
|
||||||
const cache = getAppSettingsCache();
|
patchAppSettingsCache({ uiPreferences: next });
|
||||||
const merged: AppSettingsDto = { ...cache, uiPreferences: next };
|
|
||||||
Object.assign(cache, merged);
|
|
||||||
|
|
||||||
pendingPatch = pendingPatch
|
pendingPatch = pendingPatch
|
||||||
? (deepMerge(pendingPatch as Record<string, unknown>, patch as Record<string, unknown>) as Partial<UiPreferences>)
|
? (deepMerge(pendingPatch as Record<string, unknown>, patch as Record<string, unknown>) as Partial<UiPreferences>)
|
||||||
|
|||||||
Reference in New Issue
Block a user