Skip to content

fix: 서버 상태 재검증과 카드 리스트 비활성 쿼리 캐시 격리 - #88

Merged
haewonwon merged 2 commits into
developfrom
refactor/app-alignment-8
Jul 25, 2026
Merged

fix: 서버 상태 재검증과 카드 리스트 비활성 쿼리 캐시 격리#88
haewonwon merged 2 commits into
developfrom
refactor/app-alignment-8

Conversation

@haewonwon

@haewonwon haewonwon commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

작업 개요

  • 화면 재진입·앱 복귀 시 서버 상태가 재검증되도록 React Query staleTimefocusManager(AppState)를 연동
  • measurement 과거 날짜 조회도 동일하게 재검증되도록 PAST_DATE_STALE_TIME을 조정
  • 카드 리스트에서 비활성 pin/queue 쿼리의 캐시·페이지네이션·총 개수가 결과에 섞이지 않도록 수정

변경 유형

  • 기능 추가
  • 버그 수정
  • UI/스타일 변경
  • 리팩터링
  • 설정/빌드/CI 변경
  • 문서 변경

UI 변경 사항

  • 변경된 화면: 카드 리스트 (필터 타입 전환 시 목록/건수), 전역 데이터 갱신(앱 복귀·화면 재진입)
  • 스크린샷/영상:

테스트

  • npm run type-check
  • npm run lint
  • iOS Simulator 확인
  • Android Emulator 확인
  • 실제 기기 확인
  • 해당 없음

환경변수/설정

  • 새 환경변수 없음
  • .env.example 업데이트 완료
  • EAS/GitHub Secrets 설정 필요

필요한 값:

참고 사항

Summary by CodeRabbit

  • Bug Fixes
    • Improved data refresh when returning to the app or revisiting screens, helping display up-to-date records changed elsewhere.
    • Fixed schedule card lists so pin and queue results, pagination, and totals are handled correctly based on the selected view.
    • Prevented unnecessary pagination requests for inactive schedule modes.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

React Query now tracks React Native app focus and treats server data as immediately stale. Schedule card lists, pagination, and totals now conditionally use enabled pin and queue queries.

Changes

Query and schedule updates

Layer / File(s) Summary
App focus and stale-time revalidation
src/app/_layout.tsx, src/lib/api/query-client.ts, src/domains/measurement/api/queries.ts
React Query focus follows AppState, the default stale time is 0, and past measurement data is immediately stale.
Mode-aware schedule composition and pagination
src/screens/schedule/card-list/hooks/use-card-list-screen.ts
Schedule data, pagination fetching, and card totals now include only enabled pin or queue query results.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main changes: server-state revalidation and isolated card-list query caches.
Description check ✅ Passed The description follows the template closely and covers scope, change type, UI impact, tests, and environment notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/app-alignment-8

Comment @coderabbitai help to get the list of available commands.

@haewonwon
haewonwon merged commit 662be69 into develop Jul 25, 2026
4 of 5 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/_layout.tsx`:
- Around line 3-8: Guard the AppState focus-listener setup in the root layout’s
useEffect so it runs only on native platforms and is skipped for Expo web
builds. Preserve the existing focusManager.setFocused behavior and cleanup for
supported native platforms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b3fc72e8-b881-4995-a96c-f5c2d2092c6c

📥 Commits

Reviewing files that changed from the base of the PR and between e4f96d3 and 54736b6.

📒 Files selected for processing (4)
  • src/app/_layout.tsx
  • src/domains/measurement/api/queries.ts
  • src/lib/api/query-client.ts
  • src/screens/schedule/card-list/hooks/use-card-list-screen.ts

Comment thread src/app/_layout.tsx
Comment on lines +3 to +8
import { focusManager, QueryClientProvider } from '@tanstack/react-query';
import { useFonts } from 'expo-font';
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import { useEffect } from 'react';
import { AppState } from 'react-native';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
fd -HI -t f '^(package\.json|app\.json|app\.config\..*)$' . \
  -x rg -n '"web"|react-native-web|expo export' {}

Repository: unplan-tave/unplan-app

Length of output: 1444


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '\n## src/app/_layout.tsx\n'
sed -n '1,120p' src/app/_layout.tsx | cat -n

printf '\n## package.json platform signals\n'
sed -n '1,220p' package.json | cat -n

printf '\n## app config files\n'
fd -HI -t f '^(app\.json|app\.config\..*)$' . -x sh -c 'echo "--- {}"; sed -n "1,220p" "{}" | cat -n'

Repository: unplan-tave/unplan-app

Length of output: 10549


Guard the AppState focus override on web builds.

This app supports Expo web, so this listener should be skipped there; otherwise focusManager.setFocused can interfere with the browser’s focus handling.

Proposed fix
-import { AppState } from 'react-native';
+import { AppState, Platform } from 'react-native';

  useEffect(() => {
+   if (Platform.OS === 'web') {
+     return;
+   }
+
    const subscription = AppState.addEventListener('change', (state) => {
      focusManager.setFocused(state === 'active');
    });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { focusManager, QueryClientProvider } from '@tanstack/react-query';
import { useFonts } from 'expo-font';
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import { useEffect } from 'react';
import { AppState } from 'react-native';
import { AppState, Platform } from 'react-native';
useEffect(() => {
if (Platform.OS === 'web') {
return;
}
const subscription = AppState.addEventListener('change', (state) => {
focusManager.setFocused(state === 'active');
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/_layout.tsx` around lines 3 - 8, Guard the AppState focus-listener
setup in the root layout’s useEffect so it runs only on native platforms and is
skipped for Expo web builds. Preserve the existing focusManager.setFocused
behavior and cleanup for supported native platforms.

Sources: Coding guidelines, MCP tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant