mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3673
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1787
Author: @Scotty-Hudson
Created: 10/10/2026
Status: ❌ Closed
Base:
main← Head:f-676-sidebar📝 Commits (8)
da3d892web: saved chats in a sidebar, kept in localStorage (#676), opt-in9702d6bweb: the new chat stays empty after a reload (#1787)0619514web: the chat list in IndexedDB (#1787)213af4aweb: read the list from the request, not the store (#1787)a193d27web: the review fixes for the chat sidebar (#1787)7fcbfc7web: the chat sidebar tests, run against app.js (#1787)e340b95web: the review fixes for the chat sidebar and its tests, second pass (#1787)fb38ddcweb: a click inside the rename field keeps the rename open (#1787)📊 Changes
6 files changed (+920 additions, -38 deletions)
View changed files
➕
serve/test_chat_sidebar.js(+401 -0)➕
serve/test_chat_sidebar.py(+183 -0)📝
serve/web/app.css(+36 -0)📝
serve/web/app.js(+253 -10)📝
serve/web/index.html(+46 -28)📝
serve/web/sprite.svg(+1 -0)📄 Description
Issue: Resolves #676
Problem and result
The web page keeps one chat. A reload, a "New chat", or a tab switch leaves the conversation on the screen and nowhere else, so there is nothing to go back to.
With the switch on (off by default), the left sidebar holds the list of chats: open one, rename it, delete it with Undo, search it, grouped by day. They live in the browser — IndexedDB, database
strata, storechats, one record per chat — because a conversation can be several megabytes andlocalStorageis capped at about 5 MB for the whole page. With the switch off the page is the one from the last release: one chat understrata.chat, and IndexedDB is never opened.Related discussion
#676 is the request (the tracker sweep closed it as stale on 2026-10-13; a comment with the 0.1.44.1 version line asks for it to be reopened). #361 was closed with the note that this
serve/web/app.jswork is welcome. The +1 there said a minimal version — list, open, rename, delete, storage — would cover them; this is that, plus the day groups and the search box.The review on #1787 raised two things, both fixed in the branch:
New chatduplicated the chat migrated fromstrata.chatafter a reload, andlocalStorage(about 5 MB for the whole page) is too small for multi-megabyte conversations, so the list moved to IndexedDB. A third report — a click inside the rename field ended the rename — is fixed too.Approach
serve/web/app.jsstrata.history, off by default) and the chat list: entries of{id, title, time, messages}, one IndexedDB record per chat — cheaper than re-serialising the whole list for one message. The open chat is the one on the screen, soapiMessages()and the request path are as they were.strata.chatgets it as the first record; a browser that will not take IndexedDB (private mode) keeps the list in memory and says so once.QuotaExceededErrorsays the storage is full, an abort for another reason does not).serve/web/index.html— the<aside>(hidden until the switch is on) and the switch row under About > Settings.serve/web/app.css— the sidebar, the rows, and the narrow-screen overlay (under 760px the list overlays the chat).serve/web/sprite.svg— one symbol,i-edit, for rename.serve/test_chat_sidebar.py,serve/test_chat_sidebar.js— new, described under Validation.What it leaves alone: every engine file and the request path;
store.setand the other storage keys (the small ones — the switch, which chat is open — stay inlocalStorage); the export button; the sampling drawer, the Monitor, the API; and "New chat" when the switch is off, which still clears the chat with an Undo. No new network calls, nothing about the list goes to the server.How I checked the default path.
app.jsrun against a stub DOM, the same actions on main'sapp.jsand on this branch with the switch off:Same key, same contents after every step. To be exact about "byte-identical": with the switch off the storage key, the contents and the behaviour are the same as the last release; the page does carry the sidebar markup and the switch row, and the chat sits inside one extra wrapper div, so the HTML is not identical — the sidebar is hidden and nothing in it runs. If you would rather have the markup itself behind the switch, say so and I will generate it from JS.
Validation
Passed:
On
fb38ddc7, rebased ontomainatcbfd5b92(v0.2.1.3). Linux, Python 3.14.4, node v24.21.0. Re-run after the rebase; the earlier runs were on9094446b/f57c0adc.serve/test_chat_sidebar.pychecks the page and the served routes, and runs the js file (it skips on a machine without node).serve/test_chat_sidebar.jsrunsapp.jsagainst a stub DOM and a stub IndexedDB — twenty outcomes: the read, the write, private mode, a full storage, a store that is not there, a blocked open, a fresh database, a read transaction that aborts, an abort for another reason, a reload, the single chat when off, the search, the day groups, rename through the field, a click inside the rename field, delete with Undo, and delete of a chat the list does not hold.The stub is faithful only where the code depends on it: the result of a read is on the request and not on the store, a refused write fires
abort, a blocked open never resolves on its own, thechatsstore exists only because the upgrade handler made it, and requests answer on a later tick, so the code cannot pass by answering too early.Each check was verified by putting the old code back and running it again: eighteen fail, including the two bugs the review found.
Failed: none observed.
Not run: real quota limits (no browser here fills a quota on demand); the cross-tab case (a chat written in another tab does not show until that page is reloaded, because there is no event for it); a real browser's IndexedDB — headless Chrome here cannot persist storage across invocations, and the server serves an allowlist of
serve/webfiles, so the js file is a model of the page, not a browser.Limits
The search reads every chat's message text, so the whole store is in memory after the first load — which is the multi-megabyte case raised in the review. The search box stays in the PR; if you would rather have it over titles only, that would let the app keep titles and timestamps apart from the message bodies.
Pictures and files are stored as their names only, so a picture shows while the page lives and becomes its name after a reload. IndexedDB would allow keeping them as blobs; that needs a second store (so the list can load without the images) and an eviction rule, so it is not in this PR.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.