Codebase audit: fix bugs, performance issues, dead code, and edge cases
1. Bugs fixed:
- Backup schema now accepts theme: "aero" so backups exported under
Frutiger Aero pass parseBackup on import, and applyImport in "replace"
mode replaces SRS schedules, answer history, and chats instead of
merging into existing SRS or skipping empty arrays.
- Typed FillBlank cards bind the input value to chosen ?? value instead
of chosen ?? "", and normalise() preserves Unicode letters (\p{L}\p{N})
when grading non-ASCII answers.
- OpenAI-compatible vision calls (contentFor in lib/openai-compat.ts)
prefix data:image/jpeg;base64, when routes pass stripped base64.
- Streaming calls (ollamaChatStream, providerChatStream) keep their
AbortController active across the entire body stream and API routes
forward request.signal so stopping a chat or cancelling a run aborts
the upstream request immediately.
- HomeworkCard uses homeworkModeLabelKey so "check" records display the
Checked label instead of Step-by-step guide.
- Desktop dropzones on /create and /homework accept dropped documents as
well as images.
- LibraryScreen filters reported questions out of its due and mistake
counts to match ReviewClient.
- Clearing a provider key resets generation if it pointed at that
provider; chat conversations persist and restore provider; ModelPicker
keys items by provider:name.
- RouteTransition no longer mutates module-level lastPath during render.
- Service worker asset handler falls back to Response.error() when an
uncached asset fetch fails offline.
- Confetti and .ice-orb / .ice-bubble respect the in-app reduce-motion
toggle.
2. Performance & cleanup:
- Deduplicate window storage listeners across all six localStorage
stores (one listener while subscribed instead of N^2 notifications).
- Use todayAnswerCount in LibraryScreen and pass sorted folders to
DeckCard.
- Memoize MessageRow with stable callbacks in ChatScreen and compute
last message IDs in a single pass.
- Close ImageBitmap after drawing in lib/image.ts and destroy pdf.js
documents in finally in lib/documents.ts.
- Avoid re-parsing serialized sync payloads in POST /api/sync.
- Deduplicate copyText (lib/share.ts -> lib/clipboard.ts), chatMessageId,
describeExtraction, ALL_FOLDERS, useIsPhone, and remove unused helpers
and boilerplate public/*.svg files.
Version 0.5.8, SW -> freezmo-v80.
This commit is contained in:
parent
303e73f555
commit
982391ca45
57 changed files with 714 additions and 497 deletions
29
README.md
29
README.md
|
|
@ -1423,6 +1423,35 @@ Things I chose while building, with the reasoning:
|
|||
(measured: 268..1280 at a 1280 window) — a flat pane floating 40px inside the scene read as
|
||||
"cut off next to the sidebar".
|
||||
|
||||
89. **Codebase-wide audit (bugs, performance, dead code, edge cases).**
|
||||
- *Bugs fixed:* Backup schema now accepts `theme: "aero"` (backups exported under Frutiger Aero
|
||||
used to fail `parseBackup` on import), and `applyImport` in `"replace"` mode now replaces SRS
|
||||
schedules, answer history and chats instead of merging into existing SRS or skipping empty
|
||||
arrays; typed `FillBlank` cards (without word-bank options) now bind the `<input>` to the live
|
||||
typed state (`chosen ?? value` instead of `chosen ?? ""`) and preserve non-ASCII Unicode
|
||||
letters (`\p{L}\p{N}`) when checking answers; OpenAI-compatible vision calls (`contentFor` in
|
||||
`lib/openai-compat.ts`) now prefix `data:image/jpeg;base64,` when routes pass stripped base64;
|
||||
streaming calls (`ollamaChatStream`, `providerChatStream`) keep their `AbortController`
|
||||
attached for the entire body stream and API routes forward `request.signal` so stopping a chat
|
||||
or cancelling a run aborts the upstream request immediately; `HomeworkCard` uses
|
||||
`homeworkModeLabelKey` so `"check"` records show "Checked" instead of "Step-by-step guide";
|
||||
desktop dropzones on `/create` and `/homework` accept dropped documents as well as images;
|
||||
`LibraryScreen` excludes reported questions from its due and mistake counts (matching
|
||||
`ReviewClient`); clearing a provider key resets `generation` if it pointed at that provider,
|
||||
chat conversations persist and restore `provider`, and `ModelPicker` keys items by
|
||||
`provider:name`; `RouteTransition` no longer mutates module-level `lastPath` during render;
|
||||
`public/sw.js` falls back to `Response.error()` when an uncached asset fetch fails offline;
|
||||
confetti and `.ice-orb`/`.ice-bubble` respect the in-app `reduce-motion` class.
|
||||
- *Performance & cleanup:* The six `localStorage` stores now attach a single `storage` listener
|
||||
while subscribed instead of one per subscriber (avoiding $N^2$ notifications and $N\times$ JSON
|
||||
parses); `LibraryScreen` uses `todayAnswerCount` instead of building the full 35-day stats
|
||||
object on every render and passes sorted `folders` down to `DeckCard`; `MessageRow` is wrapped
|
||||
in `React.memo` with stable callbacks so streaming tokens only re-render the active message;
|
||||
`prepareImageFromBlob` closes its `ImageBitmap` and `extractPdf` destroys the `pdf.js`
|
||||
document proxy in `finally`; `POST /api/sync` no longer re-parses the serialized sync blob;
|
||||
`lib/share.ts` reuses `copyText` from `lib/clipboard.ts` (including its HTTP LAN fallback);
|
||||
and unused helpers and `create-next-app` SVG placeholders in `public/` were removed.
|
||||
|
||||
88. **A custom 404, Frutiger Aero style.** Unknown URLs used to fall through to Next's default
|
||||
"This page could not be found". `app/not-found.tsx` now renders a standalone screen — the root
|
||||
layout's ice scene is the backdrop, and the glass card, the rim and the rising bubbles come from
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue