-
Notifications
You must be signed in to change notification settings - Fork 350
refactor: プロジェクト保存周りの関数を別ファイルに切り出してリファクタリング #2573
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
refactor: プロジェクト保存周りの関数を別ファイルに切り出してリファクタリング #2573
The head ref may contain hidden characters: "refactor--\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3059\u308B\u95A2\u6570\u3092\u30E6\u30FC\u30B9\u30B1\u30FC\u30B9\u306B\u5FDC\u3058\u3066\uFF13\u3064\u306B\u5206\u5272"
Conversation
|
🚀 プレビュー用ページを作成しました 🚀 更新時点でのコミットハッシュ: |
…ルを保存する関数をユースケースに応じて3つに分割
|
いけてそうだったのでdraft開けました!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR refactors the project saving functionality by extracting related functions into a dedicated helper file and reorganizing store actions and types to remove conditionals and improve clarity.
- Separates the SAVE_PROJECT_* use cases into distinct functions in saveProjectHelper.ts
- Introduces showErrorDialog for common error display and simplifies error message handling in ResultError
- Updates store directories and action names for improved maintainability and consistency
Reviewed Changes
| File | Description |
|---|---|
| src/store/project/saveProjectHelper.ts | New helper functions for project saving logic |
| src/store/project/index.ts | Store actions now reference the new helper functions and updated action names |
| src/components/Dialog/Dialog.ts | Adds an exported showErrorDialog for handling error display |
| src/type/result.ts | Modifies ResultError to use only the result code in the error message for brevity |
| src/store/type.ts | Updates and adds TypeScript types for actions and action context |
| src/components/Talk/ToolBar.vue | Updates store actions calls to match the new action names |
| src/components/Menu/MenuBar/MenuBar.vue | Updates store actions calls to match the refactored action names |
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
|
|
||
| constructor(public readonly result: FailureResult<E>) { | ||
| super(`${result.code}: ${result.error.message}`, { cause: result.error }); | ||
| super(`${result.code}`, { cause: result.error }); |
Copilot
AI
Feb 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResultError now only includes the result code in its error message, which may reduce debugging clarity. Consider including additional error detail or the original message to aid in troubleshooting.
| super(`${result.code}`, { cause: result.error }); | |
| super(`${result.code}: ${result.error.message}`, { cause: result.error }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ごもっともなんだけど、errorToMessage関数に投げることを考えると、result.error.messageはcause: error側でも現れるから、ここはエラーコードだけをメッセージにするのが良いかなぁと。
sevenc-nanashi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
特に問題なさそう。
…ルを保存する関数をユースケースに応じて3つに分割
|
レビューありがとうございます、マージします!! これでstoreの関数を外に書き出しやすくなる!!!! |
内容
タイトルのとおりです。
store/project.tsをstore/project/index.tsに移動し、ついでに関数をファイル切り出しします。このPRには提案が3つ含まれてます:
SAVE_PROJECT_*系3つのユースケースを別々に関数に分け、if分岐をなくすリファクタリングshowErrorDialog関数その他
エラーメッセージはこんな感じ