Bug in Reveal-Widget when using (non-existing) stateTitle in combination with stateField

58 views
Skip to first unread message

Mirko Richter

unread,
Jan 31, 2019, 3:00:23 PM1/31/19
to TiddlyWiki
Hi,

i realized a (probably?) bug in the reveal-widget of 5.1.19 when using stateTitle+stateField (rather than just state) in combination with a non-persistent/-existing (temporary) stateTitle. Here is a problematic example:

<$reveal type="match" stateTitle=<<qualify "$:/state/rimi/tag-selection/$type$">> stateField="scope" text="local" default="local">... </$reveal>

When i used it that way (with the $:/state-namespace) it worked until the first reload of the TW (because $:/state doesn't persist over that). The next reloads produced an "TypeError: this.wiki.getTiddler(...) is undefined"-error when opening that tiddler. The browser-error directly pointed to the following code-position in the reveal-widget (regarding chrome it is around #122 -- i didn't crosscheck that):

[...]
/*
Read the state tiddler
*/

RevealWidget.prototype.readState = function() {
 
// Read the information from the state tiddler
 
var state = this.stateTitle ? (this.stateField ? this.wiki.getTiddler(this.stateTitle).getFieldString(this.stateField) :
[...]

As stated in the last line of the code-snippet above, TW assumes that this.wiki.getTiddler(this.stateTitle) must exist (by being directly dereferenced) in case this.stateField is set. This isn't a wanted behaviour or do i oversee something?

PS: In my case i switched to the usage of state which is in my case more tolerant. So no hurry here from my side.

Thanks in advance,
Mirko

BurningTreeC

unread,
Feb 1, 2019, 9:03:03 AM2/1/19
to TiddlyWiki
Hi Mirko, thanks for reporting!

This is a bug and an oversight. I've added this part of the code, so I'll create a pull request to fix it!

Thanks,
BTC
Reply all
Reply to author
Forward
0 new messages