fix: editable decrypt + windows realtime wake (v0.7.1)
Edit message decrypt: - handleUpdate in useConversationMessages now refetches the canonical row via REST after a realtime UPDATE instead of trusting the realtime payload's bytea encoding. Same pattern as handleInsert — base64 vs `\x…` hex serialisation varies across supabase/postgrest versions and was silently producing undecryptable ciphertext for edited messages on the receiver side Windows WebView2 background throttling: - ConversationsContext, useFriendships and useConversationMessages now listen for visibilitychange / focus / online events and trigger both a fresh REST refresh and a best-effort channel.subscribe() on wake. WebView2 aggressively throttles background WebSockets and was dropping realtime events entirely while the window was minimised, so new messages and friend acceptances only surfaced after a manual reload Bump tauri version 0.7.0 -> 0.7.1
This commit is contained in:
@@ -44,7 +44,24 @@ export function useFriendships(userId: string | undefined): FriendshipsState & {
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
// Windows WebView2 throttles background sockets — refresh on wake.
|
||||
const onAwake = () => {
|
||||
if (document.visibilityState !== 'visible') return;
|
||||
void refresh();
|
||||
try {
|
||||
channel.subscribe();
|
||||
} catch {
|
||||
/* already live */
|
||||
}
|
||||
};
|
||||
document.addEventListener('visibilitychange', onAwake);
|
||||
window.addEventListener('focus', onAwake);
|
||||
window.addEventListener('online', onAwake);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('visibilitychange', onAwake);
|
||||
window.removeEventListener('focus', onAwake);
|
||||
window.removeEventListener('online', onAwake);
|
||||
void supabase.removeChannel(channel);
|
||||
};
|
||||
}, [userId, refresh]);
|
||||
|
||||
Reference in New Issue
Block a user