Skip to content

Pi asks: keep unsent answers, and a calmer card layout - #282

Merged
TannerMidd merged 1 commit into
TannerMidd:release/0.28.0from
vitalNohj:upstream/ask-answers-kept
Nov 5, 2026
Merged

TannerMidd merged 1 commit into
TannerMidd:release/0.28.0from
vitalNohj:upstream/ask-answers-kept

Conversation

@vitalNohj

Copy link
Copy Markdown
Contributor

Closes #281

Keeps the unsent answers on a Pi asks card when you switch sessions or reload, and clears them once the card is done. It also spaces the card's questions out so a card with several reads more easily.

What it does

  • The person who may answer has their picks and typed text saved for that card, per person, through person-storage.js, the way the message box keeps a draft. Switching to another session and back, whether or not the tab has shown that session before, or reloading, shows them again.
  • A card for someone else stays as it is and saves nothing.
  • The saved answers are cleared on Send, on Decline, when the question leaves while its card is on screen because the run stopped or it was answered elsewhere, and on sign-out. A question that ends while the tab shows another session leaves its entry until sign-out; nothing shows it again, because the card is gone. Archiving a session does not cancel its question, so the card and its answers stay.
  • A Send the server turns down (for example an answer over 4096 characters) keeps the answers, so you can fix them and try again.
  • A different card starts empty. A saved entry that no longer fits the form is removed, so it cannot come back later.
  • A secret field's unsent text is kept the same way as the other fields: in this browser's storage until one of the above clears it.

Layout

Each question now has more room above it (24px) than inside it (8px), and its header tag always sits on its own line above the question, so short and long questions start the same way. Option labels and descriptions start at the top, options in one row are the same height, and an odd last option takes the whole row on wide screens instead of leaving a hole. "Or type your own answer" is a quieter one-line box under that question's options, so it no longer looks like one more option, and a hairline sets Decline and Send apart from the last question. CSS only, with the app's existing variables; on a phone the options stay one column and at least 44px tall.

Screenshots

A card with three questions: one long question with two long options, one with three options, and one with three options where more than one can be chosen.

Before (desktop):

Before, desktop

After (desktop):

After, desktop

After, light theme:

After, light theme

After, phone (390px):

After, phone at 390px

Tests

  • Pick a choice and type an answer, switch to a session the tab has not shown yet and back, and the card shows both. A reload still shows them.
  • Switch with the app's own navigation between two sessions the tab has already shown, and the pick and its saved entry are still there when you come back. This failed before the fix.
  • Send an answer the server turns down: the saved entry stays and a reload shows the typed text. This failed before the fix.
  • After Send, the saved entry is gone. A new card starts empty.
  • Sign-out clears the saved entry.
  • Someone else sees the waiting card and their browser keeps no answer.
  • The existing mobile test still finds the options at least 44px tall.

Decline, a stopped run, a question answered elsewhere, and a saved entry that no longer fits are not covered by a test of their own.

npm run check passes. eslint and prettier pass on the touched files. node --test --test-concurrency=2 on test/ask-answers-ui.test.ts, test/ask.test.ts, test/approvals.test.ts, and test/person-storage.test.ts: 17 tests, 17 pass. With test/mobile-ui.test.ts added: 44 tests, 44 pass.

@TannerMidd
TannerMidd merged commit a5aa30c into TannerMidd:release/0.28.0 Nov 5, 2026
2 checks passed
TannerMidd added a commit that referenced this pull request Nov 5, 2026
…ne short test

A kept Pi asks card saved every field on each key, a secret field's
password too, in clear text in the browser's storage until sign-out.
A secret field is now kept empty, to type again after a switch or a
reload.

On a touch screen the card's own answer box stays 44 px high, as
every touch target; the global placeholder color serves it.

test/ask-answers-ui.test.ts: 346 lines and 4 tests to 139 and one,
covering each risk; 7 mutations each make it fail.

Follow-up to #282 by @vitalNohj.
TannerMidd added a commit that referenced this pull request Nov 5, 2026
The answers were kept by the approval's id, which is unique only while
it waits, and only a card on screen dropped them. A question that ended
while another session showed, or before a reload, left them until
sign-out, and a later ask with the same id got them back.

They are now kept by session, each under the ask's id and the time it
asked, and the card is one per ask. Each read or save of a session's
answers drops those of asks no longer waiting.

Follow-up to #282 by @vitalNohj.
TannerMidd added a commit that referenced this pull request Nov 5, 2026
…ks again

e4f6066 kept answers under the ask's id and the time it asked. After a
restart the ask tool asks again from the same call with the same id but
a new time, so the card came back empty and its answers were dropped.
An ask is now its id and its call, or the time it asked when it has no
call: the same call asking again keeps its answers, and a later ask
with the same id from another call is still a new one.

Follow-up to #282 by @vitalNohj.
TannerMidd added a commit that referenced this pull request Nov 5, 2026
…tab kept

keptAsks dropped the answers of asks missing from the session's view,
also when that view was the copy the tab kept, which may be old. Back
in a session whose ask ended while another tab answered a later one,
the kept copy's card dropped the later ask's answers from the shared
storage.

Answers of ended asks now go only by a view the server sent since the
session showed (viewSynced in store.js): as it comes, and as a card
leaves it. A kept view drops nothing.

Follow-up to #282 by @vitalNohj.
TannerMidd added a commit that referenced this pull request Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants