Skip to content

Conversation

Copy link

Copilot AI commented Dec 4, 2025

対応Issue

概要

  • React Server Components の重大なセキュリティ脆弱性に対応するため、React を RC 版から安定版 19.2.1 にアップデート
  • React 19 の型システム変更に伴うコード修正

実装詳細

依存関係の更新

  • react: 19.0.0-rc-66855b96-2024110619.2.1
  • react-dom: 19.0.0-rc-66855b96-2024110619.2.1
  • @types/react: ^18^19.2.7
  • @types/react-dom: ^18^19.2.3

React 19 型定義への対応

  1. useRef の初期値を明示的に指定(型安全性の向上)
// Before
const previousInitialDataRef = useRef<string>();

// After
const previousInitialDataRef = useRef<string | undefined>(undefined);
  1. JSX.ElementReactElement に変更
// Before
const Icons: { [key: string]: JSX.Element } = { ... };

// After
const Icons: { [key: string]: ReactElement } = { ... };
  1. Storybook Decorator の型を React 19 対応に修正
// Before
const FormProviderDecorator = (Story: StoryFn, context: StoryContext) => { ... };

// After
const FormProviderDecorator: Decorator = (Story) => { ... };

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

テスト項目

  • 型チェックが通ること (pnpm run type-check)
  • ビルドが成功すること (pnpm run build)
  • 既存機能が正常に動作すること
  • Storybook が正常に表示されること

備考

参考: https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components

peer dependencies の警告について
Next.js 15.0.3 と react-textfitfix が React 19.2.1 を明示的にサポートしていないため警告が出ますが、Next.js 15 は React 19 RC をサポートしていたため互換性に問題はありません。

Original prompt

概要

React Server Components に重大なセキュリティ脆弱性が発見されました。

参考: https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components

現状

user/package.json で使用している React のバージョン:

  • react: 19.0.0-rc-66855b96-20241106
  • react-dom: 19.0.0-rc-66855b96-20241106

対応内容

  1. user/package.jsonreactreact-dom を安定版の React 19 にアップデートする
  2. 関連する @types/react@types/react-dom も React 19 対応版にアップデートする

要件

  • Draft PR として作成してください
  • レビュアーに hikahana をアサインしてください

This pull request was created as a result of the following prompt from Copilot chat.

概要

React Server Components に重大なセキュリティ脆弱性が発見されました。

参考: https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components

現状

user/package.json で使用している React のバージョン:

  • react: 19.0.0-rc-66855b96-20241106
  • react-dom: 19.0.0-rc-66855b96-20241106

対応内容

  1. user/package.jsonreactreact-dom を安定版の React 19 にアップデートする
  2. 関連する @types/react@types/react-dom も React 19 対応版にアップデートする

要件

  • Draft PR として作成してください
  • レビュアーに hikahana をアサインしてください

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 4, 2025
Co-authored-by: hikahana <106811268+hikahana@users.noreply.github.com>
Copilot AI changed the title [WIP] Update React and React DOM to stable version 19 React 19.2.1 安定版へのアップデートとセキュリティ脆弱性対応 Dec 4, 2025
Copilot AI requested a review from hikahana December 4, 2025 03:29
@hikahana hikahana requested a review from harata-t December 4, 2025 03:50
"embla-carousel": "^8.6.0",
"embla-carousel-react": "^8.5.2",
"framer-motion": "^12.4.2",
"next": "15.0.3",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"next": "15.0.3",
"next": "15.0.5",

nextの方もかな

スクリーンショット 2025-12-04 12 55 42

// initialDataが変更されたら、フォームの値をリセットする
// 深い比較のためにJSONを使用し、パフォーマンスを考慮してuseRefで前回の値を記録
const previousInitialDataRef = useRef<string>();
const previousInitialDataRef = useRef<string | undefined>(undefined);
Copy link
Contributor

Choose a reason for hiding this comment

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

undefinedは許容しない
後で治す

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