Skip to content
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) 循環参照の解きほぐし #12602

Closed
samunohito opened this issue Dec 8, 2023 · 5 comments
Closed

(refactor / frontend) 循環参照の解きほぐし #12602

samunohito opened this issue Dec 8, 2023 · 5 comments
Assignees
Labels
packages/frontend Client side specific issue/PR 💚Refactor Rewriting code without changing behavior

Comments

@samunohito
Copy link
Member

samunohito commented Dec 8, 2023

Summary

os.tsはフロントエンド全体のユーティリティ的な立ち位置にあり、便利機能が多数実装されている。
それ故に多数のモジュールから参照されているため、循環参照の温床になってしまっている。

これを機能ジャンルごとに解きほぐし、ソースコードの整理を図りたい。

UPDATE:
account.ts、custom-emojis.tsも同列に対応しなければならない

Purpose

コードの見通しの改善などもあるが、主目的としてはHMRの改善である。
大部分のモジュールで循環参照が発生しており、それ故に一部分が書き換わるHMRが行えず全体リロードとなってしまう。これを改善し、開発体験の向上を図る。

@samunohito samunohito added packages/frontend Client side specific issue/PR 💚Refactor Rewriting code without changing behavior labels Dec 8, 2023
@samunohito
Copy link
Member Author

(先に #12560 を倒すので着手自体は後になると思われる)

@samunohito
Copy link
Member Author

(軽く確認してるけど、os.tsだけじゃなくて他の便利系モジュールもやらないとダメだ…)

@samunohito samunohito changed the title (refactor) os.tsの解きほぐし (refactor / frontend) 循環参照の解きほぐし Dec 13, 2023
@samunohito samunohito self-assigned this Dec 16, 2023
@samunohito
Copy link
Member Author

samunohito commented Dec 16, 2023

段階を分けてプルリクを作ります(でないと影響範囲が広すぎて死ぬ)

  • os.tsでscripts/api.tsの持ち物を再exportするのをやめる(scripts/api.tsを見るようにする)
  • importの整理(IntelliJの機能を使う)
  • account.tsの分割(参照用・更新用でファイルを別にする。$iを参照するためにaccount.stをimportするところすべてで循環参照が発生するので)
  • custom-emojis.tsの分割(同上)
  • os.tsの分解(ダイアログを使うためにos.tsをimportする箇所すべてで循環参照が発生するので
  • router.tsの分解

@samunohito
Copy link
Member Author

出すタイミングも、次のリリースが終わってからにしようと思います(でないと以下略)

@samunohito
Copy link
Member Author

根本であるrouter.tsを何とかできたのでcloseします。
router.tsに流れ着いて循環するケースがほとんどだったので、あとはもう対応不要な認識。必要なら再度open or 別issueとさせていただきます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/frontend Client side specific issue/PR 💚Refactor Rewriting code without changing behavior
Projects
None yet
Development

No branches or pull requests

1 participant