Is that a bug ? Undefined variable on the $:/core/ui/EditTemplate/fields cause all the tiddlers to be deleted when creating a new field

<$let 
newFieldNameTiddler=<<qualify "$:/temp/NewFieldName">> 
>
<$transclude tiddler="$:/core/ui/EditTemplate/fields"/>
</$let>

If you try to add a field with this, all your tiddlers will be deleted. Deleting an existing field doesn’t cause this issue.

Meanwhile, this work fine :

<$let 
newFieldNameTiddler=<<qualify "$:/temp/newFieldNameTiddler">> 
newFieldValueTiddlerPrefix=<<qualify "$:/temp/newFieldValueTiddlerPrefix">>
>
<$transclude tiddler="$:/core/ui/EditTemplate/fields"/>
</$let>

https://demos.tiddlyhost.com/#Maybe%20a%20bug%20-%20fields%20edit%20template

A user on discord had all of his tiddlers deleted after he did this command: “npm update -g tiddlywiki”
According to him, he tried to update a field when it happened and he think that the issue is related.

1 Like

Thanks @telumire

I think that what might have happened is this:

  1. The user had a custom editor arrangement equivalent to the first example you posted, which worked OK
  2. The user upgraded to v5.2.3 (via “npm update -g tiddlywiki”)
  3. v5.2.3 includes https://github.com/Jermolene/TiddlyWiki5/pull/6511 which modifies the variables expected by the template $:/core/ui/EditTemplate/fields in a way that is not backwards compatible

We actually had a lot of problems with that PR and backwards compatibility, but I don’t think we considered the possibility that the template might be being reused in the field in this way.

I’ve created a ticket here:

3 Likes

Thanks a lot Jeremy !

2 Likes

Hi, I am the user to whom this happened. (Fortunately I often make backups so I didn’t lose too much)

I don’t know if this could be useful, but some added information :

This is probably not helpful given you already know what is going on, but we never know.

1 Like

Thank you @dionisos that is helpful, I’ve updated the ticket.

Thank you, @telumire, for taking the time and creating a concise reproduction, and also thank you, @dionisos, for narrowing down the problem to PR #6618. This was great preparatory work and made finding this bug really easy. I already located the culprit and will update the bug with the details. After I’ve done some more testing, I’ll create a PR with a fix.

4 Likes

I have also been experiencing this (particularly nasty) bug from time to time (including today).

I am not sure what are the exact conditions for the bug to trigger, but it happens when adding a field to a tiddler, if the field value text field isn’t shown, as in thie bottom of this screen capture - I do have Stroll installed in this notebook, something that I am phasing out:

Upon hitting the “add” button, a rapid series of “delete” tasks are triggered on the server, looking to delete the entire content of the notebook (note how resuming the server resumes the deletion):

My work around has been (when I don’t forget about it) to use @Mohammad “Show field” button from this Utility plugin, and add the new tiddler field from there (shown above the tiddler content).

image

A fix for this bug has landed in the TiddlyWiki5 Pre-Release.

5 Likes

Thanks a lot @FlashSystems !