fix : ArchivePage createdAt undefined 에러 수정#58
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @IISweetHeartII, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 ArchivePage에서 메모리 데이터를 처리할 때 memory.createdAt 필드가 정의되지 않아 발생할 수 있는 잠재적인 애플리케이션 충돌을 해결합니다. 이 변경사항은 데이터의 견고성을 높이고, createdAt 값이 누락된 메모리도 안정적으로 처리할 수 있도록 보장하여 사용자 경험을 개선합니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| const memoriesByDate = useMemo(() => { | ||
| const grouped: Record<string, Memory[]> = {}; | ||
| memories.forEach((memory) => { | ||
| if (!memory.createdAt) return; |
There was a problem hiding this comment.
memory.createdAt이 undefined일 수 있는 경우를 처리하기 위해 가드 구문을 추가한 것은 좋습니다. 이로써 런타임 에러를 방지할 수 있습니다.
하지만 이는 src/types/memory.ts의 Memory 타입 정의와 실제 API 데이터 간의 불일치가 있음을 시사합니다. 현재 Memory 인터페이스에는 createdAt이 string 타입의 필수 필드로 선언되어 있지만, 실제로는 undefined가 전달될 수 있는 것 같습니다.
장기적으로는 Memory 타입을 다음과 같이 수정하여 실제 데이터 모델을 정확하게 반영하는 것이 좋습니다.
export interface Memory {
// ...
createdAt?: string;
}이렇게 하면 타입스크립트가 코드베이스 전체에서 createdAt 속성을 안전하지 않게 사용하는 다른 부분을 컴파일 시점에 감지하여 앱의 안정성을 높일 수 있습니다.
memory.createdAt이 undefined일 때 split 에러 발생하는 문제 수정