Tiddlywiki5: Bug: Creating a New Journal Tiddler deletes existing Journal Tiddler when `$:/config/NewJournal/Text` is non empty

Created on 1 Dec 2017  路  12Comments  路  Source: Jermolene/TiddlyWiki5

Steps to reproduce:

  1. Go to tiddlywiki.com, and create a new journal entry (using the button, or manually) and type in "Test journal entry text" and save.
  2. Open the shadow tiddler: $:/config/NewJournal/Text and type: "overwrite text" and save.
  3. Press the new journal button again

Desired Result:
Pressing this button should open the already existing journal entry, OR create a new one with a (1) after the name with "overwrite tex"

Actual Result:
A tiddler with the same title as today's journal is opened whose content is "overwrite text". If this is saved, it will overwrite your journal entry! If this is instead discarded, you get back your original journal entry.

Originally reported here:
https://groups.google.com/d/msg/TiddlyWiki/3zBqF4MA9WU/_UguFixpBAAJ

As part of this thread:
https://groups.google.com/d/msg/TiddlyWiki/3zBqF4MA9WU/YZY9EfcYBAAJ

bug

Most helpful comment

I think this is indeed a bug; the long term behaviour is that one can click the "new journal" button without worrying about whether one has already created a new journal today.

At first, I thought the problem was introduced in 967b123b51c06ab4e14470196f0a15064167a8f4, but actually I think it goes back further.

The underlying issue is that additional fields provided in the tm-new-tiddler message have always taken precedence over values for those fields in any existing tiddler.

We could fix the OP by changing the tm-new-tiddler behaviour so that the existing tiddler fields take priority, but that would break backwards compatibility. The existing behaviour is useful for making a new tiddler by cloning an existing one but changing/overriding certain fields.

An alternative, more radical, solution would be to switch the "new journal" button to using a template tiddler. This is already supported by the tm-new-tiddler message handling, but it isn't wired up for creating new journals. We'd also need to expose a user interface in control panel for setting the name of the template tiddler, and for directly editing the text and tags for compatibility with the present arrangement.

All 12 comments

OR create a new one with a (1)

IMO not needed: use something like this: DDth MMM YYYY - 0hh:0mm:0ss for the title, will give enough granularity.

But overwriting an existing tiddler text, is definitely a problem. ...

Pressing this button should open the already existing journal entry

It does. Does it not for you?

If it does. Please close this issue.

I think this is indeed a bug; the long term behaviour is that one can click the "new journal" button without worrying about whether one has already created a new journal today.

At first, I thought the problem was introduced in 967b123b51c06ab4e14470196f0a15064167a8f4, but actually I think it goes back further.

The underlying issue is that additional fields provided in the tm-new-tiddler message have always taken precedence over values for those fields in any existing tiddler.

We could fix the OP by changing the tm-new-tiddler behaviour so that the existing tiddler fields take priority, but that would break backwards compatibility. The existing behaviour is useful for making a new tiddler by cloning an existing one but changing/overriding certain fields.

An alternative, more radical, solution would be to switch the "new journal" button to using a template tiddler. This is already supported by the tm-new-tiddler message handling, but it isn't wired up for creating new journals. We'd also need to expose a user interface in control panel for setting the name of the template tiddler, and for directly editing the text and tags for compatibility with the present arrangement.

@tobibeer, it does not, when $:/config/NewJournal/Text has content in it.

I just tried on tiddlywiki.com a whole range of scenarios, with text in $:/config/NewJournal/Title, without text, and never had a scenario where it would not open the existing tiddler. So, I'm mildly confused, since I cannot replicate any overwriting.

Ah, $:/config/NewJournal/Text ! :D

But then a crucial question is indeed, why is this not happening when the text is blank / undefined? I imagine there could be some reveal magic that has the button behave differently, i.e. "if exists, use tm-edit-tiddler, otherwise use tm-new-tiddler".

I Posted a Solution here

Reproduced in part.

  • What I have noticed on my wiki and tiddlywiki.com is that the new tiddler is created with a draft title of YYYY-MM-DDspace which when saved, has the trailing space removed.
  • On a subsequent creation the new tiddler is created with a draft title of YYYY-MM-DD which does not yet exist so no overwrite warning occurs, nor can the existing tiddler be opened.
  • If you remove the space from the title before saving it will tell you Target tiddler already exists
  • If you leave the extra space in the title on save it removes the space and overwrites the previous one.

So the bug that needs fixing is to remove the unwanted space from the end of the New Journal Tiddler name.

The extra space is not found in $:/config/NewJournal/Text
It occurs in New Journal and New Journal Here
The fault is in the buttons

  • $:/core/ui/Buttons/new-journal
  • $:/core/ui/Buttons/new-journal-here

Edit both buttons and look for the line

  • <$action-sendmessage $message="tm-new-tiddler" title=<>
  • Remove the unnecessary space from after $(journalTitleTemplate)$
  • This will fix it in your Wiki and we need one of the developers to submit the fix.

This has being tested at tiddlywiki.com

Regards
Tony

@AnthonyMuscio ... very good catch. ... The problem is: The space was introduced to fix a different bug. ... If the last character of the template is a double-quote " the button will break. :(

So adding your proposal will re-introduce this "edge-cases bug" ... Similar to my "space-fix". It activated your issue :/

So the real solution will be a bit trickier .. but solvable.

@AnthonyMuscio ... the title-fix will not solve the original issue. ... It's a different problem

Sorry I was responding to a different problem, as Mario suggested the one cause by the fix and I followed a link to this issue. Next time I will read the whole thread.

no problem. ... I think we will have a fix for both issues soon :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KendrickLamarck picture KendrickLamarck  路  4Comments

0xMH picture 0xMH  路  6Comments

diego898 picture diego898  路  5Comments

phenomenal11 picture phenomenal11  路  5Comments

twMat picture twMat  路  4Comments