TW v5.3.0-pre: Problem with autocomplete plugin

I encountered this bug while trying to use the autocomplete plug in. Try typing [[ in this demo wiki and an error message pop ups.

I have added only the autocomplete plug in and one trigger for autocompletion into this wiki.

Can someone else also check and confirm this.

I thought it might relate to one of the other half-dozen plugins (especially CM). But it causes the same problem on an empty TW file as well. This makes me wonder if lots of other plugins will be breaking.

This happened in my upgraded main wiki without any official plugins (except the twitter plugin). Obviously I have back up and I upgraded only for testing purposes. I forgot to use an empty version of tw for demo purpose.

It looks like 5.3.0 version of $tw.wiki.filterTiddlers at the javascript level is not 100% compatible with previous versions.

For core developers and @Maurycy, here is the code which is no longer compatible:

It is called from here:

The filterTiddlers function now expects the input widget to have an evaluateVariable function property:

The backwards compatibility, I’m sure is intended at the wikitext level, but I’m not sure about the javascript level. Less incompatibility is better and maybe it is possible to reduce the incompatibility.

1 Like

The bad thing is that whoever uses this plugin (or other that break) and updates TW they’ll just get a random, confusing red error of doom. I’ll publish a fix to my plugin this week.

2 Likes

Thank you @arunnbabu81 @Maurycy @btheado @Mark_S

I am working on this problem now. I think it should be possible to refactor things to make the “evaluateVariable” method be a static method so that it is not required to be present on “fake widgets” like this.

3 Likes

Hi @arunnbabu81 it’s taken a few weeks, but I’ve refactored the code to avoid having to introduce the new “evaluateVariable()” method, which should avoid the problem you’ve encountered.

I’d be grateful if you could repeat your test with the latest version of the code from https://tiddlywiki.com/prerelease and let me know how you get on.

@jeremyruston I will definitely do it once I am back on my desktop today or tomorrow.

Hi @jeremyruston – I just tested the Auto Complete plugin in the prerelease and got a different error: TypeError: widget.getVariableInfo is not a function.

I also tested my local version of the Command Palette plugin, which I’d modified based on @cdaven’s proposed but uncommitted changes. It had been producing the same widget.evaluateVariable is not a function error in the prerelease whenever I started typing into the popup, and now produces the same new error message as Auto Complete.

I mention this only for completeness’ sake—I assume fixing one will fix both—but I’m attaching the modified plugin in case anyone wants to look at it. $ _plugins_souk21_commandpalette_modified.json (90.4 KB)

@jeremyruston I did the testing now and as @etardiff stated I am getting an error - TypeError: widget.getVariableInfo is not a function

The previously reported error message was like this - TypeError: widget.evaluateVariable is not a function

I didn’t noticed any error message when I used unedited version of command palette plug in.

Both the plug ins are installed in this demo wiki which is based on the pre-release wiki link you shared

Thank you @etardiff @arunnbabu81 – I’ve posted a further fix which I’ve tested with the autocomplete plugin, let me know how you get on.

2 Likes

Error message no longer happens with the latest fix. Thank you @jeremyruston . Here is the demo wiki.