Skip to content

Conversation

@TkymHrt
Copy link
Member

@TkymHrt TkymHrt commented Jan 12, 2026

対応Issue

https://nut-m-e-g.slack.com/archives/C020WQ3GY07/p1768051810911529

概要

Recoil を Zustand に置き換えるリファクタリングを行いました!
React 19 において Recoil が動作しないため、アプデを見越してのPRです。

主な変更点は以下です。

  • Zustand(v5)導入、永続化は公式の persist(localStorage)で実装
  • authAtom / userAtomauthStore / userStore に移行
  • _app.tsx の RecoilRoot を削除
  • 該当コンポーネント・ページ・Storybook の Recoil 使用箇所をすべて Zustand に置換
  • LLMが誤解するので、README.md のパッケージマネージャー表記を pnpm に統一

画面スクリーンショット等

  • N/A

テスト項目

  1. ビルド・Lint

    • make build が成功すること
    • make run-lint が通ること
  2. 認証フロー

    • サインインしてヘッダーにユーザー名が表示されること
    • ブラウザをリロードしてもログイン状態が維持されること(永続化)
    • サインアウトで状態がクリアされ、ルートにリダイレクトされること
  3. ページ遷移と権限制御

    • 各ページ(/my_page, /purchase_report_list, /fund_informations 等)が以前通り動作すること
    • ユーザー権限によるリダイレクトが期待通りに動くこと

備考

ついでに権限ないユーザーがページにアクセスしたとき、内容が一瞬見れてた問題も解消しておきました✌

@gemini-code-assist
Copy link

Summary of Changes

Hello @TkymHrt, 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!

このプルリクエストは、将来のReact 19へのアップデートを見据え、現在の状態管理ライブラリであるRecoilをZustandにリファクタリングするものです。主要な状態(認証情報やユーザーデータ)の管理をZustandストアに移行し、永続化機能もZustandのミドルウェアで再実装しました。これにより、アプリケーションの基盤がよりモダンで将来性のあるものになります。

Highlights

  • RecoilからZustandへの移行: React 19でのRecoilの非互換性に対応するため、状態管理ライブラリをRecoilからZustand (v5)へ全面的に置き換えました。
  • 永続化の実装: Zustandの公式persistミドルウェアを使用し、localStorageによる状態の永続化を実装しました。
  • ストアの再構築: authAtomuserAtomをそれぞれauthStoreuserStoreというZustandストアに移行しました。
  • RecoilRootの削除: _app.tsxからRecoilRootコンポーネントを削除し、Recoilの依存関係を完全に排除しました。
  • コードベース全体の更新: Recoilを使用していた全てのコンポーネント、ページ、およびStorybookのストーリーをZustandベースの実装に更新しました。
  • README.mdの修正: LLMが誤解しないよう、README.md内のパッケージマネージャー表記をpnpmに統一しました。
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、RecoilからZustandへの状態管理ライブラリの移行を目的としており、React 19への将来的な対応を見据えた素晴らしいリファクタリングです。全体として、移行はきれいに実行されており、Zustandのpersistミドルウェアの扱いや、ストアの構成も適切です。

1点、MainLayoutコンポーネントのuseEffectフックの依存配列について、認証状態の変更に即座に反応するために修正を提案しました。ご確認いただければ幸いです。

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 12, 2026

Deploying finansu with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0645514
Status: ✅  Deploy successful!
Preview URL: https://f8d24b71.finansu.pages.dev
Branch Preview URL: https://refactor-yama-migrate-to-zus.finansu.pages.dev

View logs

@TkymHrt TkymHrt requested review from Kubosaka and hikahana January 12, 2026 15:59
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.

2 participants