Skip to content

Conversation

@atomisu0312
Copy link
Contributor

選択中の色情報についても、Jotaiライブラリで管理する方式に切り替えました。

以前のチケットと同じ要領でリファクタしています。
#265

以下、コミットメッセージのコピーです。

  • selectedColorおよびselectedColorBackgroundに関するatomの定義をstore内で定義
  • カスタムフックを通じて他のコンポーネントからjotaiで管理するatomを呼び出すように更新

- selectedColorおよびselectedColorBackgroundに関するatomの定義をstore内で定義
- カスタムフックを通じて他のコンポーネントからjotaiで管理するatomを呼び出すように更新
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the selected color state management to use Jotai library instead of local React state. The refactoring introduces centralized color state management through atoms and custom hooks, following the same pattern as a previous refactoring effort.

  • Migrated selectedColor and selectedColorBackground from local React state to Jotai atoms
  • Created a custom hook useSelectedColor to abstract color state operations
  • Removed prop drilling by eliminating color-related props from component interfaces

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
front/src/store/event/venueedit/color.ts Defines Jotai atoms and actions for color state management
front/src/hooks/event/venueedit/submenu/useSelectedColor.ts Custom hook providing color state and update functions
front/src/hooks/event/venueedit/submenu/useColorPalette.ts Updated to use Jotai-based color management
Multiple hook files Removed selectedColor props and integrated useSelectedColor hook
Multiple component files Simplified props interfaces by removing color-related parameters

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

// 削除した色が選択されていた場合、最初の色を選択
if (selectedColor === color) {
setSelectedColor(colorPalette[0])
updateSelectedColor(colorPalette[0])
Copy link

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

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

This code attempts to access colorPalette[0] after filtering out the selected color, but if the selected color was the only color in the palette, this would cause an error when trying to access an undefined element. Consider checking if the filtered array has elements before accessing the first element.

Copilot uses AI. Check for mistakes.
@atomisu0312 atomisu0312 self-assigned this Aug 18, 2025
@YasunariIguchi YasunariIguchi merged commit 9654668 into develop Oct 22, 2025
2 checks passed
@YasunariIguchi YasunariIguchi deleted the feature/#269 branch October 22, 2025 09:15
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