Skip to content

fix: GroupByRepoでcreated_atがundefinedの場合にsplitでクラッシュする問題を修正#1306

Merged
swfz merged 1 commit intomainfrom
fix/kusa-group-by-repo-undefined-created-at
Mar 22, 2026
Merged

fix: GroupByRepoでcreated_atがundefinedの場合にsplitでクラッシュする問題を修正#1306
swfz merged 1 commit intomainfrom
fix/kusa-group-by-repo-undefined-created-at

Conversation

@swfz
Copy link
Owner

@swfz swfz commented Mar 22, 2026

概要

kusaページのGroup By Repo表示で、created_atが欠損したイベントデータが渡された場合にTypeError: Cannot read properties of undefined (reading 'split')でクラッシュする問題を修正

Why

GitHub Events APIから取得したイベントデータのcreated_atundefinedのケースが存在し、iso8601DateTimeExtract関数で.split('T')を呼び出す際にTypeErrorが発生していた

前回のPR(#1303)でcommitsundefinedのケースは修正されたが、同様のパターンでcreated_atundefinedのケースが残っていた

How

  • iso8601DateTimeExtractの引数型をstring | undefinedに変更し、undefined/空文字の場合は空文字を返すガードを追加
  • contributions-by-repo.tsxrow.created_at?? ''のフォールバックを追加

確認観点

  • iso8601DateTimeExtractundefinedを渡した場合のテストが通ること
  • iso8601DateTimeExtractに空文字を渡した場合のテストが通ること
  • created_atundefinedのPushEventでContributionsByRepoがクラッシュしないテストが通ること
  • 既存テストがすべて通ること(jestで17テスト全パス)

created_atが欠損したイベントデータが渡されるとiso8601DateTimeExtractで
TypeError: Cannot read properties of undefined (reading 'split')が発生するため

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 22, 2026

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

Project Deployment Actions Updated (UTC)
tools-oswo Ready Ready Preview, Comment Mar 22, 2026 9:36am

@swfz swfz merged commit c4a8b4f into main Mar 22, 2026
8 checks passed
@swfz swfz deleted the fix/kusa-group-by-repo-undefined-created-at branch March 22, 2026 09:38
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