Shouldn't list filter be used with widgets?

During the process of debugging the vue-tabs plugin, I found that the widget wrapped by the list filter will be executed multiple times with the refresh of tiddlywiki. This is of course no problem for general widgets, but it may be a problem for some widgets that cannot eliminate side effects. A disaster, such as the timer left by the widget that cannot be cleared. I have tried to avoid this situation, such as fixing the widget somewhere on the page, but the list filter is an exception. What I can think of is to use the list-filter judgment logic is placed directly in the widget instead of wrapping the widget outside.

Do I understand correctly about the widget refresh problem? @jeremyruston

You use the list-widget as an if-command. So if the filter returns 3 elements then the <$vue-tags/> widget will be executed 3 times.

You should use the Conditional Shortcut syntax now. - or- You need to make sure your list has is only 1 result.

Edit: uups – Just saw that your filter only has 1 result :confused:

I think the problem here is that the filter result is different depending on the number of draft tiddlers. When the result of the filter changes, say, from 3 to 2 then the list widget will remove the old list item representing the value “3” with a new list item representing the value “2”.

If that theory is correct, then I would expect this filter to perform better because it ensure that the same result is returned whenever the filter is true:

[list[$:/StoryList]!has[draft.of]count[]compare:number:gt[0]then[true]]
3 Likes