-
-
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
fix(frontend): 通知が重複して受信される問題を修正 #13531
base: develop
Are you sure you want to change the base?
Conversation
(cherry picked from commit 5739f5e)
if (!connection) { | ||
connection = useStream().useChannel('main'); | ||
if (connection) { | ||
connection.on('notification', onNotification); | ||
connection.on('notificationFlushed', reload); | ||
} | ||
} |
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.
deactivatedされた後に通信が復活しないのもなんかアレな気がしたのでこれは型定義を良さそうな感じにした上で復活した
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.
connectionの詳細な仕様をよくわかってないので必要無い説はある
function onNotification(notification: Misskey.entities.Notification) { | ||
const isMuted = props.excludeTypes ? props.excludeTypes.includes(notification.type) : false; | ||
const isAlreadyShown = pagingComponent.value?.items.has(notification.id); | ||
if (isMuted || document.visibilityState === 'visible') { | ||
useStream().send('readNotification'); | ||
} | ||
|
||
if (!isMuted) { | ||
if (!isMuted && !isAlreadyShown) { | ||
pagingComponent.value?.prepend(notification); | ||
} | ||
} |
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.
その上でUIに流すかどうかをリアルタイム受信時に確認させるようにした
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #13531 +/- ##
============================================
+ Coverage 64.69% 77.67% +12.97%
============================================
Files 986 185 -801
Lines 110809 25028 -85781
Branches 5692 484 -5208
============================================
- Hits 71691 19441 -52250
+ Misses 37682 5580 -32102
+ Partials 1436 7 -1429 ☔ View full report in Codecov by Sentry. |
これコネクションを捨てるんではなく単にリスナーを外すだけにしたほうか良いやつ? |
connection = useStream().useChannel('main'); | ||
connection.on('notification', onNotification); | ||
connection.on('notificationFlushed', reload); | ||
if (!connection) { |
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.
if (!connection) { | |
if (connection == null) { |
}); | ||
|
||
onActivated(() => { | ||
if (!connection) { |
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.
if (!connection) { | |
if (connection == null) { |
connection.on('notificationFlushed', reload); | ||
if (!connection) { | ||
connection = useStream().useChannel('main'); | ||
if (connection) { |
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.
connectionが無いことはなさそう
}); | ||
|
||
onActivated(() => { | ||
if (!connection) { | ||
connection = useStream().useChannel('main'); | ||
if (connection) { |
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.
connectionが無いことはなさそう
What
Partially cherry-picked from MisskeyIO#504
Why
Fix #13517
治るかはわからない
Additional info (optional)
Checklist