chatmu · ticket 01 · re-pitch in Simplified Technical English
A short version of where this task is. Sentences are short on purpose. Domain words are the words from CONTEXT.md.
A person writes Korean text. An IME is active. The person presses a button. Nothing happens.
This is the chain of events:
The repair is known. Put the handler on pointerup and mouseup also.
You must then count the calls and keep only one. This is the half that was missing.
The repo wrote the first half by hand in many places. It wrote the second half in one place only.
The specification said six places. I counted seven.
| One press does this | It happens more than once if… | What stopped it | |
|---|---|---|---|
| 1 | Applies bold, italic or a listcomposer/Toolbar.tsx | Bold turns on, then off, then on | the button |
| 2 | Makes a Message in a Roomcomposer/PlateComposer.tsx | The Room gets the same Message twice | the handler |
| 3 | Opens the emoji panelcomposer/EmojiButton.tsx | Nothing. To open twice is to open once | the action itself |
| 4 | Makes a Userapp/signup/page.tsx | The server gets three signup requests | the handler |
| 5 | Changes the password of a Userapp/account/page.tsx | The server gets the change twice | the handler |
| 6 | Makes a Roomapp/rooms/RoomSidebar.tsx | Two Rooms get the same name | the handler |
| 7 | Changes a Messageapp/rooms/[roomId]/MessageEditSession.tsx | The server gets the change twice | the handler |
The specification did not list it. It was worse than the six.
It had mouseup only. It did not have pointerup.
No person saw a fault, because a flag in the handler stopped the second call.
That is the exact shape this ticket removes.
The browser tests count results. Three places already had a count.
| Place | Test | What it measures |
|---|---|---|
| Message | Count of Messages in the Room = 1 | the handler |
| User | Count of signup requests = 1 | the handler |
| Room | Count of Rooms with that name = 1 | the handler |
| Format (bold) | Bold is on after the press | the button, but one path only |
| Emoji | The panel is open | no count |
| Password | — | no test |
| Message change | — | no count |
And that is the argument for the change: put the rule in the button, where a person can read it.
A usual mouse press on the bold button must turn bold on one time.
Bold is a toggle. So the count shows in the result. No other place shows it.
The old test only used mouseup. No test used all three events.
Made one button: frontend/lib/pressOnce.tsx
The caller gives one handler. The button owns the four paths.
Why lib/: four of the seven places are screens. If the button lived in the composer module, the signup screen must import that module. That is the wrong direction. If it lived in the screens, the composer module must import a screen. That is the same wall from the other side.
Made "once" the default. Added no escape switch
Six of seven places need "once". One place does not care. Before, the safe behaviour was the exception.
An escape switch would put the decision back in the handler. That is the shape we remove.
Changed no handler
The flags and the "clear the input at once" rule stay. They stop a different thing: a person who really presses twice on a slow network. Two presses are two presses. A button cannot stop that.
I changed the comments only.
Kept type="submit" on the four form buttons
A form with two or more fields does not submit on Enter if it has no submit button. Signup has four fields.
So the button keeps the type, and it stops the default action of the click. The form then runs the work one time, not two.
I ran no checks. You must run them.