Skip to content

Commit dd6a8ea

Browse files
committed
social: a failed paused-chat read is drawn as an error row (#3359)
The paused-chat card's `social/paused` read swallowed its rejection, so a read that failed was drawn exactly like "this chat is not paused": the card vanished, and a card read before the failure stayed on screen with stale words. The failure now has its own state and is drawn as one quiet status line; a later success replaces it. The 5 s poll is the retry, and the card still has no button. Docs-not-needed: the card's own copy is unchanged; a failed read shows the existing `errorText()` sentence in a quiet status row, and the issue scopes the diff to `plugins/social/client.js:4010-4034` plus the new test file.
1 parent 00eb291 commit dd6a8ea

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎plugins/social/client.js‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4011,19 +4011,31 @@ window.__ModuleLoader__.load({
40114011
useStyles()
40124012
const handle = typeof bot?.remote?.handle === 'string' ? bot.remote.handle : ''
40134013
const [paused, setPaused] = useState(null)
4014+
// #3359: a read that failed is not a chat that is not paused. The failure is the card's answer
4015+
// while it lasts (the friends list draws it the same way, #3323), so it gets its own state and
4016+
// is drawn before the card; a later success replaces it.
4017+
const [error, setError] = useState('')
40144018
useEffect(() => {
40154019
setPaused(null)
4020+
setError('')
40164021
if (!handle) return undefined
40174022
let live = true
40184023
const load = () => {
4019-
call('social/paused', { handle }).then(value => { if (live) setPaused(value?.paused ?? null) }, () => {})
4024+
call('social/paused', { handle }).then(value => {
4025+
if (!live) return
4026+
setPaused(value?.paused ?? null)
4027+
setError('')
4028+
}, e => { if (live) setError(errorText(e)) })
40204029
}
40214030
// #3315 ③: a hidden tab holds no timer and reads nothing; coming back reads once at once and
40224031
// restarts the 5 s cadence from that read instead of waiting out the hidden period.
40234032
const stop = pollWhileVisible(load, 5000)
40244033
return () => { live = false; stop?.() }
40254034
}, [handle])
4026-
if (!handle || !paused) return null
4035+
if (!handle) return null
4036+
// The 5 s read is the retry: no button, no Extend, no turn count (owner 2026-10-19).
4037+
if (error) return h('div', { className: 'fs-hold', 'data-flybot': 'social-paused-error', role: 'status' }, error)
4038+
if (!paused) return null
40274039
const note = paused.reason
40284040
? tr('Bot Social paused the last chat with this Bot ({reason}).', { reason: paused.reason })
40294041
: tr('Bot Social paused the last chat with this Bot.')

0 commit comments

Comments
 (0)