Old v5.3.x Updaters

I last tested my plugins with 5.3.0. I just checked with the upcoming 5.3.4 and then the current 5.3.3 and something has broken this test case:

https://www.scss.com.au/family/andrew/tiddlywiki/tw-5.3.3.html#ChartJS%20Use%20Case%20Test

and what it should look like:

https://www.scss.com.au/family/andrew/tiddlywiki/#ChartJS%20Use%20Case%20Test

The timeline labels “V1”, “V2”, and “V3” have changed to “0”, "1’, “2”.

So something has changed in either 5.3.1 or 5.3.2 or 5.3.3, but I don’t know which!

Are the old updaters available anywhere? I’ve had a poke around the github, but if they’re there they aren’t obvious.

I’ve worked out an alternate way to get the correct label text, but have not (yet!) uploaded the fixed TWs.

I still don’t know exactly what’s going on, but it appears the filter string I use to extract the label text: “[<​context​>jsonget[chart],[data],[datasets],<​di​>,[label]]” is failing when it gets to the “[data]” part. The only clue I have is that when I inspect the relevant object hierarchy in the browser Inspector, the “data” property is faded, which by Googling seems to indicate the property is not enumerable. This is also the case in 5.3.0 (which works), so maybe a property check of some sort has been added?

This rings a bit of a bell but I am unsure at present if the change I am thinking of is the culprit:

Thanks. That looked like it could have been it. “[data]” is an “object”, not a “number”, “string”, or “boolean”. Having said that, the “[chart]” part is also an object. I set a breakpoint on the “item = undefined” and it didn’t trip…

Found the change:

in getItemAtIndex() where item is the chart object and index is “data”. The hop() call fails and “data” isn’t an array, so it returns undefined.

1 Like

@andrewg_oz – If you think this is a bug, you should create a new issue at GitHub, since the version v5.3.4 should be released soon.

The issue is the use of the hop() function:

However, the change I’ve found isn’t the change that introduced the call to hop(). I’m still looking…

I’ve already found a workaround for my use case. Since this involves accessing third-party JS object hierarchies, it’s probably not worth holding up the 5.3.4 release. It’s been around since the current 5.3.3 release anyway.

If you are able to provide a minimal test case that fails and illustrates the problem that will be helpful with debugging.

The change I found was it. Specifically the change in getDataItem() from

item = item[indexes[i]];

to

item = getItemAtIndex(item,indexes[i]);

I wonder if getItemAtIndex() should drop the call to hop():

function getItemAtIndex(item,index) {
	if($tw.utils.isArray(item)) {
		index = $tw.utils.parseInt(index);
		if(index < 0) { index = index + item.length };
	}
	return item[index]; // Will be undefined if index was out-of-bounds
}

?

I can try to contrive a test case, but that will have to be tomorrow. It’s way after my bedtime here…

I don’t think so. I asked about this before. @jeremyruston thought it might be a good idea, but his answer also made it clear that it wouldn’t be as useful as I would have hoped, and I didn’t follow up. I haven’t heard about any further progress.

Will this work for you?

https://tiddlywiki.com/#TiddlyWiki%20Archive

That has the Empty and tw.com editions for each version, but unless I’m missing it, it does not have the upgraders, as far as I can see.

It would be very useful to have, for instance, https://tiddlywiki.com/archive/full/TiddlyWiki-5.1.17/upgrade.html. But those don’t exist, and the editions just point to the central upgrader.

As @Scott_Sauyet says, there are only the empty and full versions, no upgrader. I was going to try upgrading in steps from 5.3.0 to narrow down the problem, but @saqimtiaz turned up and basically pointed me at it. (aside: from the date of the change it was introduced in 5.3.2).

Also, I can confirm that the change to getItemAtIndex() that I’ve suggested fixes the issue for me. If you really wanted to keep the hop() in there, then the following also works:

function getItemAtIndex(item,index) {
	if(!$tw.utils.hop(item,index) && $tw.utils.isArray(item)) {
		index = $tw.utils.parseInt(index);
		if(index < 0) { index = index + item.length };
	}
	return item[index];
}

Issue created: [BUG] jsonget fails on inherited properties · Issue #8270 · Jermolene/TiddlyWiki5 · GitHub