Users reported a bug where pressing the Esc key in edit mode causes the composer to disappear, but it reappears after refreshing the page — unlike clicking Cancel, which behaves correctly. jack2 initially described the issue, and Sirlupinwatson1 confirmed it. j.jaffeux couldn’t initially reproduce it but later confirmed it was intermittent. jack2 provided a consistent reproduction: after opening the composer and waiting for the checkmark to appear, pressing Esc causes the composer to vanish, but it returns on refresh. j.jaffeux proposed a fix and submitted a PR, but later closed it to pursue a higher-level solution. sam ultimately resolved the issue by modifying draft-saving behavior to avoid saving immediately after clicking Edit, which also addressed related frustrations for supermathie. The fix involved introducing promises to handle async behavior more reliably, as the codebase currently mixes promise and non-promise returns, complicating reasoning. The issue is now resolved, improving both Esc key behavior and copy-paste workflows.
Go to one of your post and click Edit to open the composer. Don’t type anything.
Press the Esc key => as expected, the composer disappears completely (it isn’t minimized, because the post hasn’t been modified).
Refresh the browser page => the composer comes back.
In step 2, if you click the Cancel button instead of pressing the Esc key, the behavior is correct, i.e. the composer doesn’t come back after browser refresh.
This file is mega tricky @eviltrout … can not wait till we have support for async cause a big pile of methods sometimes return a promise and sometimes return an object making it very hard to reason about things.
For now I introduced a few promises and bypasses so we do not save a draft right away after you click the edit button. This was also driving @supermathie crazy cause it made it really complicated and annoying to copy text from N replies into the OP.