Recent Discourse update broke plugin outlet in strange way

One of the changes to Discourse in the last week or so broke my plugin and I cannot work out what is actually wrong or how to fix it. Plugin worked fine for years until this point.

The plugin does various things, but the one that seems relevant here is adding a button to the user profile page.

Now, when I visit that page for any user, most of the page does not render (including the button my plugin aims to add):

(If I disable the plugin via its Settings button, the page renders OK.)

The Javascript console in Chrome shows the following exception and stack trace each time this page is refreshed:

Iā€™m not sure what to make of that error as it isnā€™t my code, and the t which is not a function isnā€™t on the line, or anything near it, which the exception is coming from. Quite confusing. But I am not a JS expert so maybe Iā€™m just missing something here.

From stepping through with the Chrome debugger, the problem happens on that line while processing my pluginā€™s template, but I cannot see what is actually causing the problem, or if itā€™s due to something I need to change/update or a bug in Discourse itself.

The plugin JS code and HBS template which I think are involved is in my user-profile-primary connector, which can be found here:

I donā€™t know for sure, but it seemed like maybe these recent Discourse commits could potentially be involved:

Any suggestions would be much appreciated!

Hi @LeoDavidson - thanks for raising this issue. Youā€™re almost certainly correct that itā€™s related to those commits - Iā€™ll dig into it and try to work out what changed. I didnā€™t intend to introduce any changes in behaviour.

But in the meantime, this PR should fix the issue by moving your plugin connectors to a more common directory layout:

10 Likes

Many, many thanks! Both for the PR and being so fast. Iā€™ve just applied it and everything looks good now!

4 Likes

Iā€™ve had a look into what caused this change in behaviour. The connectors were located like this:

assets/javascripts/discourse/templates/user/connectors/{outlet-name}/{unique-name}.js
assets/javascripts/discourse/templates/user/connectors/{outlet-name}/{unique-name}.hbs

That extra /user/ in the path means that it isnā€™t detected by our 'unColocateConnectors` logic

I had a search through all-the-plugins and all-the-themes and I donā€™t see any other occurrences of this directory layout. So Iā€™m going to leave things as-is for now, unless we get more reports of issues.

4 Likes

This topic was automatically closed after 554 days. New replies are no longer allowed.