[251104] refactor: productReducer curry 제거 - 명확한 코드로 변경

handleClearReviewFilter에서 curry를 제거하고 단계별 상태 업데이트로 변경하여
코드 안정성과 가독성을 향상시켰습니다.

**변경:**
- curry 함수 제거 (복잡도 감소)
- 단계별 state 업데이트로 변경 (명확성 증대)
- 각 초기화 단계마다 주석 추가 (유지보수성 향상)

**초기화 대상:**
1. loadedListPrdtId = null (캐시 ID 초기화)
2. reviewListData = null (전체 리뷰 데이터 초기화)
3. currentReviewFilter = null (활성 필터 초기화)
4. filteredReviewListData = null (필터 결과 초기화)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-04 16:24:25 +09:00
parent dace30b500
commit a9e8913ea4

View File

@@ -124,23 +124,21 @@ const handleFilteredReviewList = curry((state, action) => {
// All Star 필터 해제 핸들러 - 필터 상태와 필터링된 데이터를 초기화
// ✅ CRITICAL FIX: reviewListData도 함께 초기화하여 Back 시 재로드되도록 함
const handleClearReviewFilter = curry((state) => {
const handleClearReviewFilter = (state, action) => {
console.log('[productReducer_clearReviewFilter] 🟡 handleClearReviewFilter: 필터 해제됨 + 리뷰 데이터 초기화');
return set(
'loadedListPrdtId',
null,
set(
'reviewListData',
null,
set(
'currentReviewFilter',
null,
set('filteredReviewListData', null, state)
)
)
);
});
let newState = state;
// 캐시 ID 초기화 (다시 로드되도록)
newState = set('loadedListPrdtId', null, newState);
// 전체 리뷰 데이터 초기화
newState = set('reviewListData', null, newState);
// 활성 필터 초기화
newState = set('currentReviewFilter', null, newState);
// 필터링된 리뷰 데이터 초기화
newState = set('filteredReviewListData', null, newState);
return newState;
};
const handlers = {
[types.GET_BEST_SELLER]: handleBestSeller,