Feature/#19 code refactor#21
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Walkthroughデータ購読・操作を新しいフック(useEntryDetail/useEntryList/useJournalList)へ移行し、フィールドUIは FieldWrapper に統一。リスト・ジャーナル・アイコン行の生成はフック/ユーティリティに委譲されています。 ChangesCustom hooks and screen refactoring
Field component standardization
Cleanup and minor fixes
sequenceDiagram
participant EntryDetailScreen
participant useEntryDetail
participant useLiveQuery
participant updateEntry
EntryDetailScreen->>useEntryDetail: useEntryDetail(entryId)
useEntryDetail->>useLiveQuery: subscribe getEntryDetailQuery(entryId)
EntryDetailScreen->>useEntryDetail: save() / bookmark() / remove()
useEntryDetail->>updateEntry: persist / toggle bookmark / delete
🎯 3 (Moderate) | ⏱️ ~25 minutesPossibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🤖 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/`(journal)/entry/[id].tsx:
- Around line 28-29: The edit form is currently kept in the parent via
useEntryDetail (including valuesRef) and only toggled by editMode, which
prevents fresh initialization on reopen; move the ref/state hooks into a
dedicated child component (e.g., EntryEditForm) so the form is mounted/unmounted
when editMode changes. Concretely: extract the form markup and any logic that
uses valuesRef from the parent into a new component that accepts entry,
setValue, save, bookmark, remove (or minimal handlers) as props, remove
valuesRef from parent scope, and render the child conditionally (editMode ?
<EntryEditForm ... /> : <EntryView ... />) so switching modes triggers a remount
and fresh initialization; apply the same refactor to the other form instance in
this file that uses useEntryDetail.
In `@src/components/field/emtry-number.tsx`:
- Line 8: The import in emtry-number.tsx currently uses a relative path for
FieldWrapper; change it to use the project path alias by replacing the relative
import of FieldWrapper with an alias import from
"`@/components/field/field-wrapper`" (or the correct path under src that exports
FieldWrapper) so all references to FieldWrapper use the `@/` alias per the src/*
import guideline.
In `@src/components/field/entry-date.tsx`:
- Line 8: Update the relative import for FieldWrapper in entry-date.tsx to use
the project path alias instead of a relative path: replace the current
"./field-wrapper" import with the alias that points to the same module under src
(e.g. import from "`@/components/field/field-wrapper`") so all references to
FieldWrapper follow the repository's "`@/`..." convention.
In `@src/components/field/entry-long-text.tsx`:
- Line 6: Replace the current relative import of FieldWrapper in
entry-long-text.tsx with the project path-alias import that uses "`@/`..." instead
of a relative path; update the import statement that brings in FieldWrapper so
it references the module via the `@/` alias (keeping the same exported symbol name
FieldWrapper) to comply with the src/* alias rule.
In `@src/components/field/entry-text.tsx`:
- Line 6: 現在の相対パス import は規約に反するので、`import { FieldWrapper } from
"./field-wrapper";` をプロジェクトのエイリアスを使う形に置き換えてください(例: `import { FieldWrapper } from
"`@/components/field/field-wrapper`";`)—該当シンボル: FieldWrapper を含む import
文を更新して、src/* を参照するすべての相対パスを `@/...` に統一してください。
In `@src/components/field/entry-time.tsx`:
- Line 8: この行の相対インポート import { FieldWrapper } from "./field-wrapper";
をプロジェクトのパスエイリアスを使う形に置き換えてください—つまり同じエクスポート名 FieldWrapper を維持しつつインポート元を
"`@/components/field/field-wrapper`" のような `@/...` エイリアスに変更し、TypeScript
コンパイル/ESLint を通ることを確認してください。
In `@src/utils/entry/use-entry-detail.ts`:
- Line 19: useLiveQuery に依存配列が渡されておらず、entryId
が変わっても購読が更新されない問題があります。useLiveQuery(getEntryDetailQuery(entryId)) の呼び出し(関数
useEntryDetail 内)に第2引数として [entryId] を渡して依存関係を指定し、entryId
が変わったときに購読クエリ(getEntryDetailQuery)を再評価/再購読するようにしてください。
In `@src/utils/entry/use-entry-list.ts`:
- Around line 26-28: The call to useLiveQuery in use-entry-list.ts omits the
dependency array so getEntriesQuery(journalId) won't re-run when journalId
changes; update the call useLiveQuery(getEntriesQuery(journalId)) to pass the
dependency array [journalId] as the second argument (keeping the returned const
{ data: entries } and subsequent previewEntries = entries.map(buildPreviewEntry)
unchanged) so the query updates when journalId changes.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b10659c7-2ba1-4eaf-a297-a10bff76fdae
📒 Files selected for processing (19)
src/app/(journal)/edit.tsxsrc/app/(journal)/entry/[id].tsxsrc/app/explore.tsxsrc/components/all-form-list.tsxsrc/components/entry/entry-detail.tsxsrc/components/entry/entry-list-view.tsxsrc/components/field/emtry-number.tsxsrc/components/field/entry-date.tsxsrc/components/field/entry-location.tsxsrc/components/field/entry-long-text.tsxsrc/components/field/entry-text.tsxsrc/components/field/entry-time.tsxsrc/components/field/field-wrapper.tsxsrc/components/journal/icon-select-bottom-sheet.tsxsrc/components/journal/journal-view.tsxsrc/db/schemas/entries.tssrc/utils/entry/use-entry-detail.tssrc/utils/entry/use-entry-list.tssrc/utils/journal/use-journal-list.ts
💤 Files with no reviewable changes (3)
- src/app/explore.tsx
- src/components/all-form-list.tsx
- src/db/schemas/entries.ts
|
直下なのでエイリアスはしなくていい |
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 `@README.md`:
- Line 5: The image tag <img src="docs/screenshots/app-images.svg" /> in
README.md lacks an alt attribute; add a meaningful alt text describing the image
(e.g., "App screenshots" or a brief description of what's shown) to improve
accessibility and provide fallback text for screen readers and when the image
fails to load.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2b97ba20-1f6a-4b31-9e06-c024243505b7
⛔ Files ignored due to path filters (1)
docs/screenshots/app-images.svgis excluded by!**/*.svg
📒 Files selected for processing (3)
README.mdsrc/utils/entry/use-entry-detail.tssrc/utils/entry/use-entry-list.ts
概要
実施した内容
チェックリスト
備考
関連 Issue
Closes #19
Summary by CodeRabbit
削除
新規
改善
変更
ドキュメント