fix(app): keep the app on its feet — a boundary, one window, and a reading that ends

- boundary: src/ui/ErrorBoundary.tsx, around the whole app rather than around a
  screen. A throw on the way to the first paint used to be a white page with
  nothing in it to report; it is a sentence, the message and the stack now, with
  a reload beside them, so the next report of a crash carries what went wrong.

- one window: src/ui/SingleTab.tsx holds the app to one tab over localStorage and
  a BroadcastChannel. A second tab on /app or /library is told so and offered the
  roll — "use this tab" takes it, and the tab that held it gets a bar and the
  offer back. A tab holding a reading is a tab the machine has already spent its
  memory on, and a second one beside it is the memory the first will not get.

- mount: the studio and the library are mounted the first time their route is
  asked for and stay mounted after that, not on every visit. Booting CanvasKit
  (~20MB) and reading the whole catalogue on a page that shows neither is the
  read and the memory a machine short of either takes for a crash; a trip back
  from the studio is a screen opening rather than a page loading.

- reading: READ_MS bounds one touch of the disk at 30s. getFile and arrayBuffer
  on a drive that has gone away do not fail, they never settle — the lane waits
  for ever, the reading never ends, and STOP is a button with nothing left to
  read it. A frame given up on is a frame the next reading takes up again.

- reading: the rows of a walk go down a pass at a time, so a tab that never comes
  back leaves the column with the folders this reading walked rather than the ones
  the last reading did.

- reading: a stopped reading hands over the numbers it counted instead of null.
  Handed null it threw its own count away and had noughts written for every folder
  it walked that the file did not already hold, so a folder added to a drive read
  nought until the next scan.

- repair: STOP ends the afternoon. A repair is a loop the button has no handle on,
  so it holds the count of stops it started at and compares between rolls, and
  says it was cut short rather than reporting a run it did not make.

- add: a folder the browser could not name — every drive root on Windows is "\" —
  is asked for one, and a folder whose name is already another folder's is refused
  rather than folded in with it. The record, the frame ids, the walk's position
  and the number the column draws are all keyed by that name.

- wall: four hundred tiles queued ahead is a reader waiting on frames three
  screens below the one they are looking at; sixty is a screenful and the wall
  mints the rest as it scrolls. The catalogue is read back every 30s, not every
  5s — reading it back costs every thumbnail in it.

- library: the note is drawn under the frame rather than above it. A line that
  comes and goes in the flow moved the frame, the column and the strip by its own
  height every time a scan started or ended.

- manifest: "id": "/", so the installed app and the tab are one app.

- checks: tree-scan-check waited for a count of exactly four rows — a state the
  screen does not have. The wait ran out its clock and then measured whatever the
  reading had done since; it waits for the whole tree now.
This commit is contained in:
2026-10-10 17:46:44 +07:00
parent efa162f2ad
commit 7f455ef987
10 changed files with 532 additions and 52 deletions
+18
View File
@@ -492,6 +492,24 @@ export const en: Dict = {
'offline.queued': 'the server is out of reach, so this change is saved here and sent when it is back.',
'offline.pending': 'Not sent yet: {n}',
// A folder the reader pointed at that is already in the library.
'lib.dupFolder': '"{folder}" is already in the library.',
// A repair the reader cut short, told apart from one that ran to its end.
'lib.repairHalt': 'Repair stopped: {n} folders read back before it was stopped.',
// The crash screen (src/ui/ErrorBoundary.tsx).
'crash.title': 'The app hit an error',
'crash.body': 'Something went wrong. The details are below — send them along if it keeps happening.',
'crash.reload': 'Reload',
// The one-window guard (src/ui/SingleTab.tsx).
'tab.title': 'RecipesCam is open in another tab',
'tab.body': 'The app runs one tab at a time. Use that one, or move it to this tab.',
'tab.here': 'Use this tab',
'tab.close': 'Close this tab',
'tab.taken': 'Another tab just opened RecipesCam and took over.',
'tab.retake': 'Take it back',
'meta.exported': 'Downloaded {name} ({kb}KB, 300 ppi)',
};
+20
View File
@@ -499,6 +499,26 @@ export const vi = {
'offline.queued': 'máy chủ không tới được, nên thay đổi này đã lưu trên máy và sẽ gửi khi kết nối lại.',
'offline.pending': 'Chưa gửi được: {n}',
// A folder the reader pointed at that is already in the library. The picker
// gives no name back to compare by eye, so the note names the one that is there.
'lib.dupFolder': 'Thư mục "{folder}" đã có trong thư viện.',
// A repair the reader cut short, told apart from one that ran to its end.
'lib.repairHalt': 'Đã dừng sửa dữ liệu: đọc lại {n} thư mục trước khi dừng.',
// The crash screen (src/ui/ErrorBoundary.tsx). Rare, and the only thing a
// report of a blank page will have to carry.
'crash.title': 'Ứng dụng gặp lỗi',
'crash.body': 'Đã có lỗi xảy ra. Chi tiết ở dưới — gửi lại nếu còn tiếp diễn.',
'crash.reload': 'Tải lại',
// The one-window guard (src/ui/SingleTab.tsx).
'tab.title': 'RecipesCam đang mở ở tab khác',
'tab.body': 'Ứng dụng chỉ chạy một tab một lúc. Dùng tab kia, hoặc chuyển sang tab này.',
'tab.here': 'Dùng tab này',
'tab.close': 'Đóng tab này',
'tab.taken': 'Tab khác vừa mở RecipesCam và tiếp quản.',
'tab.retake': 'Lấy lại',
'meta.exported': 'Đã tải {name} ({kb}KB, 300 ppi)',
} as const;