From 7793163e0b687709f556a8e3fa41473878d3a5da Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Thu, 16 Apr 2026 16:37:07 +0700 Subject: [PATCH] fix: critical Upstash API and UX issues from second review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix setPixels() to use Upstash bitfield builder (.set().exec()) instead of flat array (would throw at runtime) - Fix getFullCanvas() to use GETRANGE for reliable binary retrieval instead of GET which may mangle BITFIELD data - Fix getUserId hash overflow: use >>> 0 instead of Math.abs() - Add client-side credit regeneration timer (1/sec) - Add exponential backoff to WebSocket reconnection (1s → 30s cap) --- src/client/App.svelte | 22 +++++++++++++++++++--- src/lib/canvas-storage.js | 34 +++++++++++++++++++++++----------- src/lib/get-user-id.js | 2 +- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/client/App.svelte b/src/client/App.svelte index 47a456c..4bc19b7 100644 --- a/src/client/App.svelte +++ b/src/client/App.svelte @@ -1,5 +1,5 @@