"New journal here" not creating unique tiddlers

I have set the title of new journal tiddlers to a timestamp like YYYY0MM0DD/0hh0mm0ss0XXX. This means that whenever I click the new journal button I get a totally new journal tiddler. But I’ve found that the “New journal here” button is opening the previously created journal tiddler, not a new one with a new timestamp.

To reproduce:

  • Go to tiddlywiki.com
  • Set the title of new journal tiddlers to YYYY0MM0DD/0hh0mm0ss0XXX
  • Enable the “New journal here” button
  • Create and save a journal tiddler using that button
  • Click the button again - the previous journal tiddler gets reopened, rather than a new one created

I don’t know if this behaviour is intended or not, but does anyone know of a workaround?

Couldn’t duplicate, I got individual journal tiddlers.

The “New journal here” button is defined here:
https://tiddlywiki.com/#%24%3A%2Fcore%2Fui%2FButtons%2Fnew-journal-here

If you examine that tiddler, you will find that the button actions are defined “inline” inside the $button definition using these three lines:

<$wikify name="journalTitle" text="""<$macrocall $name="now" format=<<journalTitleTemplate>>/>""">
<$action-sendmessage $message="tm-new-tiddler" title=<<journalTitle>> tags=<<journalButtonTags>>/>
...
</$wikify>

The problem arises because the above code calculates the journalTitle value (using the now macro) when the button is first rendered, rather than when the button is actually clicked upon.

You can correct this by moving these three lines from the journalButton() definition into a separate macro definition, like this:

\define newJournalHereActions()
<$wikify name="journalTitle" text="""<$macrocall $name="now" format=<<journalTitleTemplate>>/>""">
<$action-sendmessage $message="tm-new-tiddler" title=<<journalTitle>> tags=<<journalButtonTags>>/>
</$wikify>
\end

and then, in the journalButton() macro definition, add an actions=... parameter to the $button definition to invoke <<newJournalHereActions>>, like this:

<$button tooltip={{$:/language/Buttons/NewJournalHere/Hint}}
   aria-label={{$:/language/Buttons/NewJournalHere/Caption}}
   class=<<tv-config-toolbar-class>>
   actions=<<newJournalHereActions>>>

The result is that the $wikify widget that computes the target journal title value will be performed when the $button is pressed, rather than when the $button is initially rendered, thus producing a unique datetime value each time.

This should probably be reported on GitHub as a bug to be fixed.

enjoy,
-e

2 Likes

Just a note on this;

I make use of the non unique title to return to the same journal tiddler every day all day. I then tend to add content in that tiddler, and with a timestamp if I need

But I understand if you want more than one Journal tiddler a day, and when using new journal here you would want to have new journal tiddlers include the hours and minutes.

  • I would think making only the new Journal here button append the hours and minutes and possibly seconds, would leave the New journal button to create a single today tiddler. that is done modify Title of new journal tiddlers only modify the title used in the new here. See below.
    • The method I use incorporates a version of erics solution by prefixing the title at the last moment.

Another thing I do is on any wiki making use of journal entries is to include in all tiddlers created by Journal buttons is to set a field journal-date to the time/date stamp it was created. This makes subsequent listing easy regardless of what you name (or rename) the tiddler.

  • Simply add journal-date=<<now [UTC]YYYY0MM0DD0hh0mm0ss0XXX>> to the tm-new-tiddler

Here are the detailed instructions

  • $:/core/ui/Buttons/new-journal-here < actions here modify once for journal-date
  • The New Journal here title is currently set to title=<<journalTitle>>
  • If we modify it as follows title={{{ [<journalTitle>addprefix<now "0hh:0mm, ">] }}}
    • It will prefix the standard journal title with hours and minutes (you can change this format)
    • If you do new journal here more than once in the same minute it will reopen the tiddler.
  • $:/core/ui/Buttons/new-journal do the same as journal-date above but in the next tiddler
    • $:/core/ui/Actions/new-journal < actions here modify twice for journal-date

Here is this done on top of tiddlywiki 5.3.3
new-journal-date-timestamp-here.json (2.5 KB)

However this overwrites the core tiddlers, so I will return with a better solution soon.

It makes the configuration of unique tiddlers when using the new journal here, via a custom prefix. Eg unique for day, am/pm, hour, minutes and seconds.

  • It otherwise uses all the journal coustomisation settings

I have published a package for this to the community New journal buttons - an improved approach to Journaling

Thank you Eric for the explanation and solution :slight_smile: