Checking TW version on startup

I have taken advantage of the StartupActions to perform a few actions–all working well. I now want to add a TW version check. On startup if the version of TiddlyWiki is older than I support I want to report this to the user. I have tried $:/tags/StartupAction/Browser and $:/tags/StartupAction/PostRender tiddlers to either issue a notification and/or navigate to a tiddler—without success.

Without performing any version checks I have not been able to get a startup action to perform an $action-navigate or notification.

Questions:

  1. What is the best way to perform a version check?
  2. How does one get notifications to work on startup?
  3. How does one get navigate to a tiddler to work on startup? If not possible, what is a good solution on startup?
  4. This question is off-topic. Is there anything out there to capture and display a history of notifications?

Thank you.

1 Like
  1. Use the compare operator with the version suffix: https://tiddlywiki.com/#compare%20Operator
    and the version macro: https://tiddlywiki.com/#version%20Macro

[<version>compare:version:gt[v5.1.22]]

2 & 4. The notify mechanism might not be the best fit, notifications are transient and once they disappear they cannot be retrieved.

  1. To get the action-navigate widget to work in a startup action, wrap it in a $navigator widget. I have not verified this but it should work. Otherwise you can use the $action-listops widget to directly modify the storylist.

Another alternative would be the Alert Mechanism, though this might be a bit more visually jarring than you might have intended: https://tiddlywiki.com/#AlertMechanism
Creating an alert is as simple as creating a tiddler with the appropriate tag.

1 Like
<$navigator story="$:/StoryList" history="$:/HistoryList">
<$action-navigate $to="mytiddler"/>
</$navigator>
1 Like

This works well.

Both $navigator widget and $action-listops work in StartupActions.

Thank you.

Alternatively rather than start up actions, include this (in your plugin?)

  • if the side bar is visible create a tiddler containing
    <$text text={{{ [<version>compare:version:gt[v5.1.22]then[plugin name needs tw v5.2.0 or highter]] }}}/>
  • Tag it $:/tags/SideBarSegment and set a list-before field of $:/core/ui/SideBarSegments/site-subtitle
  • perhaps style the result to make it “hi vis”

The message will remain until the problem is fixed. The wiki upgraded or the plugin removed. You could make it a link to a tiddler with more info.

You could do something similar but with the $:/tags/AboveStory tag.

@TW_Tones - Thank you. I continue to learn new things in this group. I just might use both methods. However, the method you have provided will likely come in handy for other things.