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

Modalの分岐にObjectを使うようにした #4325

Merged
merged 4 commits into from
Jul 8, 2024

Conversation

ZOI-dayo
Copy link
Contributor

close #4189

@ZOI-dayo ZOI-dayo requested a review from Pugma June 27, 2024 03:19
Copy link

@Pugma
Copy link
Contributor

Pugma commented Jun 27, 2024

@ZOI-dayo CI落ちてるのでちょっとチェックしますね

Copy link
Contributor

@cp-20 cp-20 left a comment

Choose a reason for hiding this comment

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

コード自体はちゃんと書けてそうでGoodです!
ちょっとだけコメントしたので確認お願いします!

return GroupMemberAddModal
case 'settings-theme-edit':
return SettingsThemeEditModal
if (currentState.value && currentState.value.type in components) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should: in 演算子は結構怪しくて、これをちゃんと書くなら Object.hasOwn(components, currentState.value.type) と書くのが良い気がします

ref: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/in#%E7%B6%99%E6%89%BF%E3%81%95%E3%82%8C%E3%81%9F%E3%83%97%E3%83%AD%E3%83%91%E3%83%86%E3%82%A3

↑の例だと'toString' in {}true です

Copy link
Contributor

Choose a reason for hiding this comment

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

imo: そもそも型安全性が確保されているのでわざわざチェックする必要はないような気もします

Copy link
Contributor

@Pugma Pugma left a comment

Choose a reason for hiding this comment

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

inを消してオブジェクト内に存在するかのチェックを切ってますが、cpくんが言ってくれている通りすでにtypeの値が存在する場合はModalStateValueに含まれているので問題なさそうですね
okです!

Copy link
Contributor

@nokhnaton nokhnaton left a comment

Choose a reason for hiding this comment

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

良さそうです!
ありがとうございます!!

@ZOI-dayo ZOI-dayo merged commit 3d9a711 into master Jul 8, 2024
9 checks passed
@ZOI-dayo ZOI-dayo deleted the refactor/modal_container_conditions branch July 8, 2024 07:02
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.

ModalContainer.vue で条件分岐をオブジェクトで書き直す
4 participants