Delete all user defined fields

Hallo, there’s something that’s causing me trouble.

The goal: With a single click on a button, delete all fields (except the “system-relevant” fields).
My first approach:

<$button> delete fields
<$list filter="[all[tiddlers]]" variable="tiddlername">  
<$list filter="[fields[]] -title -text -type -tags -created -author -modified -library -url -caption -status -list -version -plugin-priority -name -description -dependents -core-version -plugin-type -current-tiddler library_version -collection -modifier -creator -source -filter -revision -bag -list-after -pretitle -posttitle -icon -var -draft.title -draft.of -color" variable="fieldname" tiddler=<<tiddlername>>>  
<$action-deletefield $tiddler=<<tiddlername>> $field=<<fieldname>> />  
</$list>  
</$list>
</$button>

That works, but not well. The problem with this solution: TiddlyWiki noticeably slows down — every keystroke is delayed.

So my second approach: Separate the button and the action so that the loops are only executed after the button press.

<$button>del fields
  <$action-sendmessage $message="tm-execute-actions" $param=DeleteUserFieldsAction />
</$button>

Now the tiddler titled: “DeleteUserFieldsAction” and typed: “application/x-tiddler-dictionary”

<$list filter="[all[tiddlers]!prefix[$:/]!is[shadow]]" variable="tiddlername">
  <$list filter="[fields[]] -title -text -type -tags -created -author -modified -modifier -creator -caption -list -plugin-type -plugin-priority -core-version -dependents -library -description -name -version -url -source -bag -filter -revision -collection -status -current-tiddler -draft.title -draft.of -color -icon -var -pretitle -posttitle" variable="fieldname" tiddler=<<tiddlername>>>
    <$action-deletefield $tiddler=<<tiddlername>> $field=<<fieldname>> />
  </$list>
</$list>

The problem here: Nothing happens. Am I missing something? Is there a better/easier solution?

Are you assuming the [fields[]] operator is working on only the tiddler from the outer list? That would be incorrect.

The number of items in the final list is going to the number of [all[tiddlers]] times the number of all fields in the wiki. This could be a large number.

Try using [<tiddlername>fields[] - text -title ... to narrow it down.

There is probably a smarter way to accomplish this but I’ll leave it up to one of the experts on the forum.

My initial thought would be to reverse the order of the lists. Something like this:

<$list filter="[fields[]]" variable=fieldname>
  <h2><<fieldname>></h2>
  <$list filter="[has<fieldname>]">
      <li><$link/></li>
  </$list>
</$list>