it works nicely, it opens the new-topic form, but if I don’t want to continue, click “Discard”
this does not discard the topic, it saves as a draft instead…
since I clicked on “Discard”, I don’t want to have it as a draft, have to clean the drafts later
wonder if this is expected using this new-topic url ?
is there a way not to save it as a draft if choose to discard it.
thanks.
how to repro:
in a theme component, add a button, its ref is set to the new-topic url as below
const topicBody = `.....`;
const title = "....";
// the url for new a topic
const createTopicUrl = `https://www.mydomain.com/new-topic?title=${title}&body=${topicBody}`;
const createTopicLink = `<span><a href="${createTopicUrl}" rel="noopener noreferrer">new topic</a></span>`;
const meta = `<div>${publisher}${pub_date} ${createTopicLink}</div>`;
const description = `<p>${description}</p>`;
// add the "new topic" button to UI
return `<li class="news-item"><hr><div class="news-title"><a href="${url}" target="_blank">${title}</a></div>${meta}${description}</li>`;
click the “new topic” button, see the new topic form opened with prefilled title and content.
click discard, confirm
check “my posts”, it has a new draft for this discarded new topic..
hey, Nate
copilot explained this below,
if this is true, wonder if could have an argument in the url to prevent this, that will be great
say &auto_save=false
thanks for your help.
Yes, that is expected in Discourse. Opening the composer via the new-topic URL (with prefilled title/body) creates a draft as soon as the composer is initialized. Even if you click “Discard” and confirm, Discourse may still keep a draft entry for that route so the content can be restored later. That behavior comes from the core composer/draft autosave logic, not your URL format.
If you want to avoid drafts, you’d need a custom approach (e.g., open a modal, copy to clipboard, or call the composer API with draft-key overrides), but the plain new-topic URL will always engage draft autosave.