New-topic links with category selected navigate to that category page

Continuing the discussion from Creating a link to start a new topic with pre-filled information:

I’m not sure if this is a bug or a feature, but if the new-topic link includes a category or category_id parameter, clicking the link takes you to that category before opening the composer. For example, clicking this link takes you to the Support category before opening the composer:

https://meta.discourse.org/new-topic?title=topic%20title&category=Support

I would prefer that Discourse did not navigate away from the current page. Is there any way to achieve that?

This change aborts the navigation if the user was already on Discourse:

The code has changed since then and now looks like this:

The if (category) { block runs before the block that checks whether the user was already on discourse, so the navigation proceeds. This feels like the wrong order to me.