Plugin priority with two same-name tiddlers?

I have a plugin I’m developing and it needs to over-ride one of the tiddlers in someone else’s plugin. I assigned my own plugin a priority of “3”, and the other plugin has no assigned priority. When I saved and reloaded, the original tiddler, not mine, is still being used.

When I click on my version of the tiddler inside the plugin, I’m shown the contents of the original tiddler (not mine). By editing the plugin, I can inspect the JSON and see that the plugin itself contains my tiddler and text, so I haven’t miscopied the wrong tiddler.

But the tiddler that “wins” when I click on the link is the original.

Is this expected behaviour ?

This sounds like a bug to me. The pluginTiddler sort looks like this:

pluginTiddlers.sort(function(a,b) {
	if("plugin-priority" in a.fields && "plugin-priority" in b.fields) {
		return a.fields["plugin-priority"] - b.fields["plugin-priority"];
	} else if("plugin-priority" in a.fields) {
		return -1;
	} else if("plugin-priority" in b.fields) {
		return +1;
	} else if(a.fields.title < b.fields.title) {
		return -1;
	} else if(a.fields.title === b.fields.title) {
		return 0;
	} else {
		return +1;
	}
});

So a plugin with no plugin-priority will load after all the ones with a priority, meaning that in essence, those without a priority will override those with one. (I’m pretty sure that I’ve read correctly that later-loaded plugins simply override the same-named tiddlers.) I believe these should be reversed:

	} else if("plugin-priority" in a.fields) {
		return +1;
	} else if("plugin-priority" in b.fields) {
		return -1;

Do I read this right, @jeremyruston, @pmario, @rmunn?

There has been a discussion at GitHub: Bug in plugin Ordering by mklauber · Pull Request #3113 · Jermolene/TiddlyWiki5 · GitHub please have a closer view. I did not dig into the details. Just searching for the discussion and commit.

There are some more links at GH. So it may be worth to have a closer look there too.

The default sort order for plugins is by name - The last one wins.

But this is defined by the authors name $:/plugins/<autor-name>/<plugin-name>/<tiddler-name> – So I think that’s not really helpful.

So I just have to change my user name to Zargon, and I can rule all the plugins!

Thanks. I added a comment there. The existing situation doesn’t seem to offer Mark any solution except for “Zargon”. And to take advantage of that, he’d have to skip the priority on his own, which means when I want to override a tiddler in his plugin, I’m going to have to use “Zygote”!