-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(frontend): router.ts解きほぐし #12907
refactor(frontend): router.ts解きほぐし #12907
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #12907 +/- ##
===========================================
- Coverage 80.02% 79.72% -0.30%
===========================================
Files 959 957 -2
Lines 109563 109114 -449
Branches 8522 8487 -35
===========================================
- Hits 87676 86995 -681
- Misses 21887 22119 +232 ☔ View full report in Codecov by Sentry. |
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.
defineというよりdefinition?
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.
definitionは名詞のようで、"定義"という言葉そのものを示すようです。
一方、defineは動詞のようなので、こちらの方が適していると考えています。
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.
見た感じdefineを行う関数があるわけでもなくdefinition自体が書かれているように見えた
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.
特にこだわりは無いので、definitionにしました
openにしました 🙏 |
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.
useRouter.tsの方がいいかも
🙏🙏🙏 |
What
#12602 の対応の一環です(書いてないけど)
この対応により、大部分のページでリロードなしのHMRが可能となります。
対応内容としては下記となります。
循環参照の巨大な温床となっていたルーティング定義を起動シーケンス(
boot/common.ts
)でのみ読み込むように切り出し。また、mainRouter
の初期化もここで明示的に行うようにした(いままではrouter.ts
が評価されたタイミングで初期化していたと思われるので)mainRouter
の保持を切り出し①で作成された
mainRouter
のインスタンスを持つためのファイルを切り出し。①を一切参照していないため、mainRouter
をimportしても循環参照が発生しないようになっている。inject
経由でのインスタンス取得方法提供mainRouter
のインスタンスそのものや、Router
を作成するためのファクトリ関数(※)をinject
経由で取得するためのユーティリティ。※
MkPageWindows
にて都度Router
のインスタンスを作る必要があるため、そこでの使用を想定Why
フロントエンドの開発効率向上および開発負担軽減
Additional info (optional)
Checklist