Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove undefined values from query string in parseQuery #84

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

himorishige
Copy link
Contributor

@himorishige himorishige commented Jun 24, 2024

v3.0.0以上でgetAllContentIdsメソッドの返り値が空の配列になる問題を解消するPRとなります。

既存の仕様だとクエリパラメーターにkey=undefinedが渡ることがありましたが、プロパティにundefinedが渡った場合はkeyとともにクエリパラメーターには含まないようロジックを変更しています。

なお、undefined以外もクエリパラメーターに渡さない場合を考慮するには条件を追加する必要があります。

Summary by CodeRabbit

  • バグ修正

    • クエリ文字列から値がundefinedのキーと値のペアを除外するように変更しました。
  • テスト

    • クエリオブジェクト内のundefined値が結果のクエリ文字列から除外されることを確認するためのテストを追加しました。

@himorishige himorishige self-assigned this Jun 24, 2024
Copy link

coderabbitai bot commented Jun 24, 2024

Walkthrough

parseQuery 関数の変更は、クエリオブジェクト内に undefined 値が含まれている場合にそれらをクエリ文字列から除外するように更新されています。また、この変更に対応するテストも追加されています。

Changes

ファイルパス 変更の概要
src/.../parseQuery.ts undefined のキーを除外するための parseQuery 関数の実装を更新。
tests/.../parseQuery.test.ts undefined 値を持つクエリオブジェクトを処理するためのテストケースを追加。

Sequence Diagram(s)

この変更は具体的なコントロールフローの変更ではなく、関数の内部の条件処理の更新のため、シーケンス図の生成は不要です。

Poem

コードの中で踊る

うさぎはクエリを整えた 🌟
undefined さようなら 👋
テストも追加し安心を 🧪
清らかなコードに
誇らしさ感じる
今日もニンジンひとつカム 🥕


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1bc3145 and f48a8bc.

Files selected for processing (2)
  • src/utils/parseQuery.ts (1 hunks)
  • tests/utils/parseQuery.test.ts (1 hunks)
Additional comments not posted (6)
src/utils/parseQuery.ts (1)

17-19: undefined 以外の値を適切に処理しています。

この変更により、クエリ文字列に undefined 値が含まれることがなくなり、関数のロバスト性が向上しています。

tests/utils/parseQuery.test.ts (5)

10-10: このテストケースは変更されていません。

既存のテストケースは正しく機能していますので、この部分についてのコメントは不要です。


18-18: このテストケースは変更されていません。

型安全性を保証するための重要なテストケースですが、変更はありません。


22-30: 新しい機能の動作を正しく検証しています。

undefined 値がクエリ文字列から削除されることを確認するテストケースです。新しい機能に対する適切なテストが行われています。


32-40: 複数の undefined 値に対応するテストを適切に行っています。

複数の undefined 値が存在する場合に、それらが正しく削除されることを検証するテストケースです。新しい機能のテストカバレッジを拡大しています。


42-50: すべての値が undefined の場合の動作を正しく検証しています。

すべての値が undefined である場合に、クエリ文字列が空になることを確認するテストケースです。重要なエッジケースを適切にテストしています。

Copy link
Member

@dc7290 dc7290 left a comment

Choose a reason for hiding this comment

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

対応どうもです!
LGTM

Copy link
Contributor

@wasabi-tr wasabi-tr left a comment

Choose a reason for hiding this comment

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

対応ありがとうございます!LGTM!

@himorishige himorishige merged commit 836942f into main Jun 24, 2024
2 checks passed
@himorishige himorishige deleted the fix/remove-undefined-property-from-searchparams branch June 24, 2024 04:58
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.

3 participants