Public: anyone can read this; the crew can change it.

The toolbar's tell box keeps what was typed when the send fails #15114

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The toolbar already behaves as the issue asks, so this pull adds only the missing test. I left src/apps/toolbar.ts unchanged. On a failed send, the submit handler shows one plain line and leaves the text in the box.

Notes

shipped production is serving it deploy 621b196

opened this

The toolbar already behaves as the issue asks, so this pull adds only the missing test. I left src/apps/toolbar.ts unchanged.

On a failed send, the submit handler shows one plain line and leaves the text in the box. On a successful send it clears the box and the saved draft. The existing test in test/apps-toolbar-draft.test.ts only checked the saved draft, not the box value or the line shown.

What changed

  • I added a test to test/apps-toolbar-draft.test.ts that covers three cases:
    • A server error leaves the box text in place and shows exactly NOTE_FAILED.
    • A network error leaves the box text in place.
    • A successful send empties the box and shows "Sent."
  • The test adds a small say() helper to the file's boot() function that returns the status lines.

Checks

  • test/apps-toolbar-draft.test.ts passes: 6 tests, 0 failures.
  • bun x tsc --noEmit and bun scripts/gate.ts --fix ran with no errors and no changes.

Left out

  • I did not write the issue's "main already does this" answer as a decline, because the second checklist item ("a test covers both") was not met on main.
  • I did not change the failure text. When the server returns its own message, that message is shown instead of NOTE_FAILED.

Try it

  • Run bun test test/apps-toolbar-draft.test.ts.

Closes #15103

commented

The toolbar already behaves as the issue asks, so this pull adds only the missing test. I left src/apps/toolbar.ts unchanged.

On a failed send, the submit handler shows one plain line and leaves the text in the box. On a successful send it clears the box and the saved draft. The existing test in test/apps-toolbar-draft.test.ts only checked the saved draft, not the box value or the line shown.

What changed

  • I added a test to test/apps-toolbar-draft.test.ts that covers three cases:
    • A server error leaves the box text in place and shows exactly NOTE_FAILED.
    • A network error leaves the box text in place.
    • A successful send empties the box and shows "Sent."
  • The test adds a small say() helper to the file's boot() function that returns the status lines.

Checks

  • test/apps-toolbar-draft.test.ts passes: 6 tests, 0 failures.
  • bun x tsc --noEmit and bun scripts/gate.ts --fix ran with no errors and no changes.

Left out

  • I did not write the issue's "main already does this" answer as a decline, because the second checklist item ("a test covers both") was not met on main.
  • I did not change the failure text. When the server returns its own message, that message is shown instead of NOTE_FAILED.

Try it

  • Run bun test test/apps-toolbar-draft.test.ts.
Approved

Test-only change; the toolbar already behaves as the issue asks, and the new test passes here. No page change, so the preview is unaffected. Two things I would do next: (1) assert the exact line in the network-error case too (NOTE_FAILED when navigator.onLine is not false); today only the box value is checked there. (2) Make say() match the status element by its own marker rather than a regex on its text, so a wrong line cannot slip past the filter.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs