fix: 서버 상태 재검증과 카드 리스트 비활성 쿼리 캐시 격리 - #88
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
📝 WalkthroughWalkthroughReact 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. ChangesQuery and schedule updates
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
src/app/_layout.tsxsrc/domains/measurement/api/queries.tssrc/lib/api/query-client.tssrc/screens/schedule/card-list/hooks/use-card-list-screen.ts
| 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'; |
There was a problem hiding this comment.
🎯 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.
| 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
작업 개요
staleTime과focusManager(AppState)를 연동PAST_DATE_STALE_TIME을 조정변경 유형
UI 변경 사항
테스트
npm run type-checknpm run lint환경변수/설정
.env.example업데이트 완료필요한 값:
참고 사항
Summary by CodeRabbit