Persist selected date across refresh#64
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@codex review this pr in korean |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef2bc6c310
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export const loadCurrentDateFromStorage = (): string | null => { | ||
| const storedDate = localStorage.getItem(CURRENT_DATE_STORAGE_KEY); | ||
|
|
||
| if (!storedDate || !LOG_DATE_REGEX.test(storedDate)) { |
There was a problem hiding this comment.
loadCurrentDateFromStorage가 YYYY-MM-DD 정규식만 검사해서 2026-13-40처럼 형식만 맞는 비실재 날짜도 통과시키고, 이 값이 apps/web/src/store/logs.ts의 initialDate로 채택되면 이후 goToPrevDate/goToNextDate에서 new Date(state.currentDate)가 Invalid Date가 되어 currentDate가 NaN-NaN-NaN으로 오염될 수 있습니다. 이렇게 되면 날짜 이동과 로컬 스토리지 키 사용이 모두 깨지므로, 현재 날짜 저장/복원 시에는 정규식뿐 아니라 실제 유효한 달력 날짜인지까지 검증해야 합니다.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebafe11152
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (let i = 0; i < localStorage.length; i++) { | ||
| const key = localStorage.key(i); | ||
| if (key && LOG_DATE_REGEX.test(key)) { | ||
| if (key && isValidDateString(key)) { |
There was a problem hiding this comment.
Keep clear-all aligned with date-key matching
clearAllLogData now deletes only keys that pass isValidDateString, so malformed-but-date-shaped keys (for example 2026-13-40) are no longer removed. This creates inconsistent behavior because data-management paths still treat regex-matching keys as logs (apps/web/src/features/dataManagement/backupService.ts uses LOG_DATE_REGEX when exporting/importing), so a user can end up with stale malformed log entries that survive “clear all” and get re-exported. Use the same key predicate across these flows or malformed keys will persist unexpectedly.
Useful? React with 👍 / 👎.
Summary
Test
src/utils/StorageUtil.test.ts,src/store/logs.test.ts