read.markets/app/static/js
Giorgio Gilestro 21835afebe analyze: send the live toggle lang from the frontend, log resolution
The /api/analyze flow previously read principal.user.lang from the
DB on every request and ignored anything the client might send. That
races the language toggle's PATCH: a user can flip the toggle and
click Generate/Regenerate before the PATCH /api/settings/language
hits the DB, so the analysis is sent with the OLD persisted lang
while the toggle visually reads as the new one. From the user's POV
the analysis comes back in the wrong language.

Frontend portfolio.js now reads the live #lang-toggle data-lang
attribute (the same source the UI itself uses) and includes it in
the /api/analyze body. The dataset attribute is updated optimistically
by cassandraSetLang() before the PATCH fires, so it always reflects
what the user is looking at.

Backend universe.py prefers payload["lang"] when present and falls
back to user.lang otherwise — older clients (scripts, direct curl)
that don't send anything still get the DB-stored preference. The
resolution path is logged so we can confirm in prod which lang
actually drove a given request.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 15:32:58 +02:00
..
chat.js ui: fix chat pending class, invented CSS vars, .pf-secondary scope 2026-05-27 19:19:42 +02:00
htmx.min.js initial commit — cassandra v0.1 2026-05-15 21:56:10 +01:00
portfolio-sync.js sync: detect orphaned blobs (pepper rotation) + fix AESGCM arg order 2026-05-25 12:49:11 +02:00
portfolio.js analyze: send the live toggle lang from the frontend, log resolution 2026-05-29 15:32:58 +02:00
portfolio_edit.js portfolio-edit: form is edit-mode only; submit becomes a + glyph 2026-05-27 15:22:13 +02:00
settings-import.js settings: extract sync + import widget JS to static files 2026-05-27 20:55:49 +02:00
settings-sync.js settings: extract sync + import widget JS to static files 2026-05-27 20:55:49 +02:00