How do I control the number of tiddlers on my recent list?

Maybe TiddlyWiki’s display history may be based on date, which will cause a problem - if I use Python or other scripting languages to import Tiddlers in batches, there are usually tens of thousands, and the list of historical records will cause TiddlyWiki to freeze directly, so I hope there is an implementation plan that can control the specific number of historical lists

1 Like

The Recent tab uses the timeline-macro which has a limit parameter, which you can use to limit the list. – But

limit

The maximum number of tiddlers to include, defaulting to 100. But if any tiddlers are included for a particular day, all of the other tiddlers for that day will also be included – even if this exceeds the limit

So this can be a problem, if you have a lot of them for 1 day – as you described.

IMO that would be worth a GitHub issue. – I’ll create one.

2 Likes

As I said, I always thought that there would be a limit for the recent list of the day, it seems that it is both there and not, and I also use my eyes to count one by one, and I thought it was caused by my vision problem

Tens of thousands of tiddlers imported by automated scripts at one time, the recently displayed list will have performance problems due to the loading length is too long, and it may not release the huge amount of memory and CPU energy consumption preloaded even if tiddlywiki is set not to display the recent display list (maybe this recently displayed list is a running variable or api function interface, and the logic of tiddlywiki may have to be opened in the browser every time regardless of whether the user uses it or not tiddlywiki)

Official knowledge base, with no description of it other than the red box,That’s not true

Can I suggest you just create your own recent tab, perhaps containing a modified version of the current tab that helps you when this is the case?

1 Like

Maybe I can delete the system entry for this recently displayed list

Do you have control over that batch generation process? And is it ok if the tiddler created/modified times stretch back into the past?

If the answer to both of these questions is “yes”, then you might be interested in the technique I use to spread out these timestamps when I generate my tiddlers in batch.

It’s pretty simple. My code is in JS, but it should be simple enough to do the same in Python or whatever you’re using.

Let’s say I have some words taken from a Shakespeare sonnet, and I want to create tiddlers for each word. I can iterate over these words, creating a tiddler for each one, setting its created/modified fields to a unique value by subtracting an increasing number of milliseconds from the current time for each one. Here I subtract off the product of my iteration index and a fixed gap of 10 minutes (600000 milliseconds):

const toTid = (time, gap) => (word, index) => ({
  title: word,
  tags: "English [[Shakespeare's Sonnets]]",
  body: `Information about "${word}" will go here`,
  created: new Date(time - index * gap).toISOString().replace(/\D/g, ''),
  modified: new Date(time - index * gap).toISOString().replace(/\D/g, ''),
})

const gap = 10 * 60 * 1000; // 10 minutes

const generateTiddlers = (words) =>
  JSON.stringify(words.map(toTid(Date.now(), gap)), null, 4)

console.log(generateTiddlers(words))

This will log something like the following to the console, but you can redirect it to a file, or with fairly minimal change, create separate tiddler files for each word:

[
    {
        "title": "let",
        "tags": "English [[Shakespeare's Sonnets]]",
        "body": "Information about \"let\" will go here",
        "created": "20240401133941801",
        "modified": "20240401133941801"
    },
    {
        "title": "me",
        "tags": "English [[Shakespeare's Sonnets]]",
        "body": "Information about \"me\" will go here",
        "created": "20240401132941801",
        "modified": "20240401132941801"
    },
    {
        "title": "not",
        "tags": "English [[Shakespeare's Sonnets]]",
        "body": "Information about \"not\" will go here",
        "created": "20240401131941801",
        "modified": "20240401131941801"
    },
    ...
]

You can see this in action; the initial part is just the creation of the list of words we will use from a sonnet.

The point is these two lines:

  created: new Date(time - index * gap).toISOString().replace(/\D/g, ''),
  modified: new Date(time - index * gap).toISOString().replace(/\D/g, ''),

With a 10-minute gap, this will create 144 tiddlers for the current day, 144 for the previous one, and so on. For 10K tiddlers, this will stretch back around 70 days. If that’s a problem, you can always increase or decrease the gap to create the balance you like.

For my own work, this is not about having too many Recent items; it’s simply some OCD about having the Recent tab sorted in the same order I have my original data; I use a gap of only one second, or even one millisecond. But the same technique may work well for you with a longer gap.

1 Like

I think that’s a good approach, which should allow you to work around that problem with fine grained control.

2 Likes

Can you get away with excluding the modified: field for tiddlers you don’t want in the recent tab? I use python to generate daily reports and I exclude the modified field on all the echarts tiddlers that are transcluded into the daily report. This allows just the daily report to show up in the recent tab.

My echart tiddlers have timestamp_name title format.

1 entry instead of 101 entries in recent.

1 Like

I can use python to do a multi-point overwrite backup of the same version, in fact, this is the result of a day of wrestling with artificial intelligence, and I think this problem you think of is especially when it comes to python, a general high-level programming language, and AI will have a better solution。

I think the effect of this plugin is exactly what you expect

ECharts for TiddlyWiki5
$:/plugins/Gk0Wk/echarts

The effect is as follows

Thank you for a valuable solution for me

It seems to make my head a little bigger, and the underlying logic seems to be to assign 10,000 equivalent tiddlers every 100 unoccupied days and quickly fill the day in python scripting language, and then assign a second group until the hundredth group

Is this the right transplant

Or maybe so

1 Like

IT technology is my hobby, and this code is a bit stiff to read for me, so I probably need to digest it first :joy:

Another approach others comments, led me to think, is to import tiddlers inside a plugin. Shadow tiddlers should not appear in the recent list.

  • when referencing your data tiddlers you will have to start your filters with [all[shadows+tiddlers]...

To me this is a good approach to bulk imports because its about automation where the recent tab is more about the interactive user environment.

No, the idea was to pipe the output of that script – a JSON string, which should be on the right panel in http://link.sauyet.com/104 – into a file, and drag that file into your wiki. For this throw-away code, it would look something like this:

[
    {
        "title": "let",
        "tags": "English [[Shakespeare's Sonnets]]",
        "body": "Information about \"let\" will go here",
        "created": "20240401133941801",
        "modified": "20240401133941801"
    },
    {
        "title": "me",
        "tags": "English [[Shakespeare's Sonnets]]",
        "body": "Information about \"me\" will go here",
        "created": "20240401132941801",
        "modified": "20240401132941801"
    },
    {
        "title": "not",
        "tags": "English [[Shakespeare's Sonnets]]",
        "body": "Information about \"not\" will go here",
        "created": "20240401131941801",
        "modified": "20240401131941801"
    },
    ....
]

The source code is meant to enhance whatever you’re doing server-side to generate this tiddlers. It simply demonstrates a simple way to space out your tiddler dates.

Thank you very much, my great god!

I seem to get the idea, it looks like a json file exported from tiddlywiki after being unzipped in python

Importing and unzipping JSON files vs. importing and zipping JSON files,Which file format will protect TiddlyWiki’s performance from being affected?Is it the former?

Yes, exactly. That same format can be used for import.

The problem now is that I need to continue to refine a python script that I wrote earlier that was converted to JSON format

The important thing is said three times, and its real file suffix is *.py

000000 - 副本.json (677 Bytes)