refactor: publishHogeStreamとStreamのEventEmitterに型定義する#7769
Merged
syuilo merged 127 commits intomisskey-dev:developfrom Oct 20, 2021
Merged
refactor: publishHogeStreamとStreamのEventEmitterに型定義する#7769syuilo merged 127 commits intomisskey-dev:developfrom
syuilo merged 127 commits intomisskey-dev:developfrom
Conversation
Contributor
Author
|
サーバー側のコードにmisskey.jsを使うのはやっぱ無理ある |
tamaina
commented
Sep 5, 2021
Contributor
Author
|
packedNotificationSchemaは別のPRにするか |
Merged
Contributor
Author
|
あ~、packedNotificationSchemaを書いたとしてもrefをよしなに解読してくれるわけではないので結局エラーは出るのか |
9 tasks
syuilo
reviewed
Sep 18, 2021
syuilo
reviewed
Sep 18, 2021
syuilo
reviewed
Sep 18, 2021
Member
|
これもうrewuiredなpr全部マージされたっぽい? |
rinsuki
reviewed
Oct 2, 2021
Comment on lines
+66
to
+95
| private onUserEvent(data: StreamMessages['user']['spec']) { // { type, body }と展開すると型も展開されてしまう | ||
| switch (data.type) { | ||
| case 'follow': | ||
| this.following.add(body.id); | ||
| this.following.add(data.body.id); | ||
| break; | ||
|
|
||
| case 'unfollow': | ||
| this.following.delete(body.id); | ||
| this.following.delete(data.body.id); | ||
| break; | ||
|
|
||
| case 'mute': | ||
| this.muting.add(body.id); | ||
| this.muting.add(data.body.id); | ||
| break; | ||
|
|
||
| case 'unmute': | ||
| this.muting.delete(body.id); | ||
| this.muting.delete(data.body.id); | ||
| break; | ||
|
|
||
| // TODO: block events | ||
|
|
||
| case 'followChannel': | ||
| this.followingChannels.add(body.id); | ||
| this.followingChannels.add(data.body.id); | ||
| break; | ||
|
|
||
| case 'unfollowChannel': | ||
| this.followingChannels.delete(body.id); | ||
| this.followingChannels.delete(data.body.id); | ||
| break; | ||
|
|
||
| case 'updateUserProfile': | ||
| this.userProfile = body; | ||
| this.userProfile = data.body; |
Contributor
There was a problem hiding this comment.
複数行に渡るなら関数内部で const { type, body } = data しちゃってもいいのでは?と思ったり
Contributor
Author
There was a problem hiding this comment.
残念なお知らせ: constで展開してもtypeとbodyの型が分離してしまうのは変わらない
ジェネリックで関数を定義しても分離してしまうのでswitch-caseのTypeScriptの仕様なんだと思う
Member
There was a problem hiding this comment.
Member
There was a problem hiding this comment.
| } | ||
|
|
||
| public publishMainStream = (userId: User['id'], type: string, value?: any): void => { | ||
| public publishMainStream = <K extends keyof MainStreamTypes>(userId: User['id'], type: K, value?: MainStreamTypes[K]): void => { |
Contributor
Author
yes |
Member
|
🆒 |
syuilo
added a commit
that referenced
this pull request
Apr 30, 2022
* clean up * ev => data * refactor * clean up * add type * antenna * channel * fix * add Packed type * add PackedRef * fix lint * add emoji schema * add reversiGame * add reversiMatching * remove signin schema (use Signin entity) * add schemas refs, fix Packed type * wip PackedHoge => Packed<'Hoge'> * add Packed type * note-reaction * user * user-group * user-list * note * app, messaging-message * notification * drive-file * drive-folder * following * muting * blocking * hashtag * page * app (with modifying schema) * import user? * channel * antenna * clip * gallery-post * emoji * Packed * reversi-matching * update stream.ts * #7769 (comment) * fix lint * clean up? * add app * fix * nanka iroiro * wip * wip * fix lint * fix loginId * fix * refactor * refactor * remove follow action * clean up * Revert "remove follow action" This reverts commit defbb41. * Revert "clean up" This reverts commit f94919c. * remove fetch specification * renoteの条件追加 * apiFetch => cli * bypass fetch? * fix * refactor: use path alias * temp: add submodule * remove submodule * enhane: unison-reloadに指定したパスに移動できるように * null * null * feat: ログインするアカウントのIDをクエリ文字列で指定する機能 * null * await? * rename * rename * Update read.ts * merge * get-note-summary * fix * swパッケージに * add missing packages * fix getNoteSummary * add webpack-cli * ✌️ * remove plugins * sw-inject分離したがテストしてない * fix notification.vue * remove a blank line * disconnect intersection observer * disconnect2 * fix notification.vue * remove a blank line * disconnect intersection observer * disconnect2 * fix * ✌️ * clean up config * typesを戻した * Update packages/client/src/components/notification.vue Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * disconnect * oops * Failed to load the script unexpectedly回避 sw.jsとlib.tsを分離してみた * truncate notification * Update packages/client/src/ui/_common_/common.vue Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * clean up * clean up * キャッシュ対策 * Truncate push notification message * クライアントがあったらストリームに接続しているということなので通知しない判定の位置を修正 * components/drive-file-thumbnail.vue * components/drive-select-dialog.vue * components/drive-window.vue * merge * fix * Service Workerのビルドにesbuildを使うようにする * return createEmptyNotification() * fix * i18n.ts * update * ✌️ * remove ts-loader * fix * fix * enhance: Service Workerを常に登録するように * pollEnded * URLをsw.jsに戻す * clean up Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
syuilo
added a commit
that referenced
this pull request
May 1, 2022
* update stream.ts * #7769 (comment) * fix lint * clean up? * add app * fix * nanka iroiro * wip * wip * fix lint * fix loginId * fix * refactor * refactor * remove follow action * clean up * Revert "remove follow action" This reverts commit defbb41. * Revert "clean up" This reverts commit f94919c. * remove fetch specification * renoteの条件追加 * apiFetch => cli * bypass fetch? * fix * refactor: use path alias * temp: add submodule * remove submodule * enhane: unison-reloadに指定したパスに移動できるように * null * null * feat: ログインするアカウントのIDをクエリ文字列で指定する機能 * null * await? * rename * rename * Update read.ts * merge * get-note-summary * fix * swパッケージに * add missing packages * fix getNoteSummary * add webpack-cli * ✌️ * remove plugins * sw-inject分離したがテストしてない * fix notification.vue * remove a blank line * disconnect intersection observer * disconnect2 * fix notification.vue * remove a blank line * disconnect intersection observer * disconnect2 * fix * ✌️ * clean up config * typesを戻した * Update packages/client/src/components/notification.vue Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * disconnect * oops * Failed to load the script unexpectedly回避 sw.jsとlib.tsを分離してみた * truncate notification * Update packages/client/src/ui/_common_/common.vue Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * clean up * clean up * キャッシュ対策 * Truncate push notification message * クライアントがあったらストリームに接続しているということなので通知しない判定の位置を修正 * components/drive-file-thumbnail.vue * components/drive-select-dialog.vue * components/drive-window.vue * merge * fix * Service Workerのビルドにesbuildを使うようにする * return createEmptyNotification() * fix * i18n.ts * update * ✌️ * remove ts-loader * fix * fix * enhance: Service Workerを常に登録するように * pollEnded * URLをsw.jsに戻す * clean up * wip * wip * wip * wip * wip * wip * ✌️ * use import * fix * install rollup * use defineAsyncComponent. * fix emojilist * wip use defineAsyncComponent * popup(import -> popup(defineAsyncComponent(() => import * draggable? * fix init import * clean up * fix router * add comment * ✌️ * ✌️ * ✌️ * remove webpack * update vite * fix boot sequence * Revert "fix boot sequence" This reverts commit e893dbf. * revert boot import * never make two app div * ; * remove console.log * change clientEntry sequence * fix * Revert "fix" This reverts commit 12741b3. * fix * add comment #8575 (comment) * add log * add comment Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve #7765
Required PR
(#7771, #7772 (merged)), #7789, #7792
What
型定義をがんばる
ついでに炙り出したバグの修正
Why
Streamまわりを開発するたびにどのようなデータが通信されているのか調べるのが面倒