A discussion on the Discourse forum addresses a bug related to saving drafts for new topics on mobile iOS. Rhidian reports that after creating a draft and attempting to open it via the “Open Draft” button, nothing happens, and the draft is not saved. The issue is reproducible on both Discourse meta and try.Discourse.org. jean.perez suggests improving error handling in the draft-saving code, proposing a catch block to manage failures. eviltrout acknowledges the complexity of the draft-saving system and supports the proposed fix. SonsOfAhriman confirms the bug on MacOS Chrome. nbianca later confirms the issue was resolved in the latest Discourse version, attributing the problem to the system allowing very short drafts to be saved, which was not intended.
Platform: Discourse mobile iOS (not tested on other platforms). Reproduced in Discourse meta and try.Discourse.org
Description: Save a draft New Topic when prompted. Open Draft button doesn’t work.
Reproducible steps:
Go to Discourse home page.
Click + New Topic
Type in subject line ‘Testing Drafts’. Type in composer body ‘Testing’. Leave as uncategorised.
Click Cancel (bin icon on Discourse mobile). You are asked if you want to Save a draft for later - click that option.
The + New Topic button changes to + Open Draft.
Click + Open Draft. Nothing happens.
Check Drafts folder - no draft is saved.
Consequence: This left me temporarily unable to create a new Topic.
Workaround: Clicking the inactive + Open Draft button a number of times eventually crashes Discourse site in mobile app and returns to domain selection. Return to Discourse - the + Open Draft has cleared and is back to + New Topic.
This saving code is unfortunately some of our oldest, and often our most fragile. Over the years we’ve layered lots of functionality on it, and some things like saving drafts which can succeed or fail need their own custom functionality which just complicates it even more.
I think your intuition is probably right here, but it’s impossible for me to confirm without seeing how all our tests run. If you have time for a PR in the future that would be great.
Thank you for the bug report. It was fixed in the latest version of Discourse. The problem was that it offered to save very short drafts even when this is not supposed to happen.