Skip to content

Persist selected date across refresh#64

Merged
seongbin9786 merged 3 commits into
mainfrom
feat/persist-current-date-on-refresh
Mar 15, 2026
Merged

Persist selected date across refresh#64
seongbin9786 merged 3 commits into
mainfrom
feat/persist-current-date-on-refresh

Conversation

@seongbin9786

@seongbin9786 seongbin9786 commented Mar 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • persist the last selected log date in localStorage
  • restore the saved date when initializing the logs store after refresh
  • add tests for current-date persistence and logs store initialization

Test

  • src/utils/StorageUtil.test.ts, src/store/logs.test.ts

@vercel

vercel Bot commented Mar 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
my-time-waea Ready Ready Preview, Comment Mar 15, 2026 8:45am

@seongbin9786

Copy link
Copy Markdown
Owner Author

@codex review this pr in korean

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread apps/web/src/utils/StorageUtil.ts Outdated
export const loadCurrentDateFromStorage = (): string | null => {
const storedDate = localStorage.getItem(CURRENT_DATE_STORAGE_KEY);

if (!storedDate || !LOG_DATE_REGEX.test(storedDate)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 실제 달력이 아닌 날짜를 저장/복원하지 마세요

loadCurrentDateFromStorageYYYY-MM-DD 정규식만 검사해서 2026-13-40처럼 형식만 맞는 비실재 날짜도 통과시키고, 이 값이 apps/web/src/store/logs.tsinitialDate로 채택되면 이후 goToPrevDate/goToNextDate에서 new Date(state.currentDate)Invalid Date가 되어 currentDateNaN-NaN-NaN으로 오염될 수 있습니다. 이렇게 되면 날짜 이동과 로컬 스토리지 키 사용이 모두 깨지므로, 현재 날짜 저장/복원 시에는 정규식뿐 아니라 실제 유효한 달력 날짜인지까지 검증해야 합니다.

Useful? React with 👍 / 👎.

@seongbin9786
seongbin9786 merged commit fa900f2 into main Mar 15, 2026
8 checks passed

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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