A shadow tiddler IS....

153 views
Skip to first unread message

Mat

unread,
May 31, 2017, 1:10:33 PM5/31/17
to TiddlyWikiDev
Someone, please correct the following statements:

Shadow tiddlers don't really exist as individual tiddlers but are only present in the plugin (in JSON format).

When you click on a title in a plugins content list, what you see as the single tiddler is created at that moment.

When the single shadow tiddler is closed, it is deleted.

There is some special mechanism that prevents the TW from getting dirty from this create/delete (i.e open/close) as long as no editing is involved.

If the shadow tid is edited, it works as an overwrite because there is some TW mechanism that, as part of loading a plugin, runs through the shadow titles list and compares it to existing tiddler titles to see if there is an overwrite to use instead of the shadow.

Thank you!

<:-)

Andreas Hahn

unread,
May 31, 2017, 3:54:24 PM5/31/17
to tiddly...@googlegroups.com
Hey Mat,

I must admit, I did have to read up on how shadow tiddlers are actually treated within TW, but here is my take on your statements:

- Shadow tiddlers exist separately from normal tiddlers and are therefore effectively marked as "originating from a plugin"

- When you click on a title in a plugins content list, what you see as the tiddler that pops up, is TW internally redirecting to the separate shadow tiddler store to determine the contents of the shadow tiddler.

- When the shadow tiddler is closed, TW removes it from the story list... nothing special here

- There is no create/delete mechanism in place when you view shadow tiddlers

- The important distinction is that the internal shadow tiddler store is read-only, meaning, if you edit and save a shadow tiddler (even without modifications), TW saves to the regular tiddler store, thus turning the tiddler into a "normal" tiddler, since now TW  will no longer redirect to the shadow tiddler store behind the scenes.


I hope this was actually more helpful than it was confusing, feel free to ask away if any more questions about this arise.
/Andreas

Mat

unread,
May 31, 2017, 8:06:30 PM5/31/17
to TiddlyWikiDev
Thanks Andreas!



- Shadow tiddlers exist separately from normal tiddlers and are therefore effectively marked as "originating from a plugin"

The thing is, I don't find them in the source in any other place than inside the plugin.


- When you click on a title in a plugins content list, what you see as the tiddler that pops up, is TW internally redirecting to the separate shadow tiddler store to determine the contents of the shadow tiddler.

"redirect to the shadow tiddler store" - ...where would this be? Is "the store" not the plugin? Surely, it can't be in memory, right?

I could imagine that what was presented as a shadow tid was really something like a transclusion presenting the JSON fields from the plugin via a template... but if this was the case then I think we'd have generally more powerful JSON features...


Again, thanks for your input.

<:-)

PMario

unread,
Jun 1, 2017, 4:47:35 AM6/1/17
to TiddlyWikiDev

Hi Mat,

Deep dive warning !!
Dev speak follows.

On Thursday, June 1, 2017 at 2:06:30 AM UTC+2, Mat wrote:
Thanks Andreas!

- Shadow tiddlers exist separately from normal tiddlers and are therefore effectively marked as "originating from a plugin"

The thing is, I don't find them in the source in any other place than inside the plugin.

Open: http://tiddlywiki.com/#%24%3A%2Fcore and expand the view. .. Select the "contents" tab and you will see them all.
 
- When you click on a title in a plugins content list, what you see as the tiddler that pops up, is TW internally redirecting to the separate shadow tiddler store to determine the contents of the shadow tiddler.

"redirect to the shadow tiddler store" - ...where would this be? Is "the store" not the plugin? Surely, it can't be in memory, right?

It is memory, that only can be reached with the $tw.wiki.getTiddler() function. The redirect means, that there is a special check in the code that handles the request. .. see: line 947 in the above link. 
 
I could imagine that what was presented as a shadow tid was really something like a transclusion presenting the JSON fields from the plugin via a template...

as seen above ...  it's a separated private memory, that can only be reached with an API call.
 
but if this was the case then I think we'd have generally more powerful JSON features...

JSON means ... JavaScript Object Notation.

A JS object is created, when ever you say:   var mytiddlers = {};

In the case of shadow tiddlers its similar to mytiddlers[title].tiddler which is also called a hashmap. Hashmaps can be used for fast "database" lookups. So you can see, that JSON is "native" in javascript, with some special twists. We have very powerfull tools, to deal with JSON. .. They are just not exposed directly to the users. ...

We have "data-tiddlers", which let you deal with basic JSON objects, without starting js programming.
 ... If you need to go deeper, you need to create js-macros, because that's the next step.

hope that helps.
have fun!
mario

 




Andreas Hahn

unread,
Jun 1, 2017, 4:48:38 AM6/1/17
to tiddly...@googlegroups.com
Hi Mat,

you're not quite right. Take a look here: http://tiddlywiki.com/dev/#Timeline%20of%20the%20startup%20Process

When TW starts up,  it at some point loads all the tiddlers it can find into whats called the tiddler store in memory. Now those also include the plugin tiddlers, e.g. '$:/core'.
Afterwards, there is another step, where TW "unpacks" the plugins and their contents are written into the shadow tiddler store, which is a separate location in memory, where TW stores them as actual tiddlers.

So yes, "the store" for shadow tiddlers is in memory, just like for ordinary tiddlers and the aforementioned redirection is on the lowest level of accessing a tiddler by its title, which makes reading from that tiddler behave exactly like for any other tiddler.

{{Note: While typing this, I noticed that there was potential for confusion: What I refer to as the "tiddler store" in the text above is the place where TW keeps the tiddlers of a wiki _after_ booting up, in working memory. The "tiddler store" that you spoke of below refers to the section of the HTML code of a saved TW, where the _saved_ tiddlers are stored and from where they will be read into working memory, when the TW boots. And as you noticed, the shadow tiddlers are contained within the plugin tiddlers in the saved section and are only unpacked at boot time into the separate shadow tiddler store located in "working memory". The link above shows a timeline of this process.}}

/Andreas

Jeremy Ruston

unread,
Jun 1, 2017, 5:33:50 AM6/1/17
to tiddly...@googlegroups.com
It would be great if this discussion could lead to an update to the docs:


Many thanks,

Jeremy


--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/4be32c1f-3080-a576-f831-a950466bc8b1%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Mat

unread,
Jun 1, 2017, 9:25:33 AM6/1/17
to TiddlyWikiDev
PMario and Andreas - big thanks!

OK, so shadow tids exist in working memory, and as actual tiddlers (not in JSON format). This is why I cannot find them when viewing the tw file source code directly. And when we click a shadow tid title, the tiddler is fetched from working memory.

I think I got the essence of it - thank you!

<:-)

Thomas Elmiger

unread,
Jun 18, 2017, 1:54:57 PM6/18/17
to TiddlyWikiDev
Hi Mat

If you look at a plugin tiddler in edit mode, then you can actually see the shadow tiddlers in JSON format. E.g. if you click the edit pencil on the tiddler here:
http://tiddlywiki.com/#%24%3A%2Fplugins%2Ftiddlywiki%2Fgoogleanalytics

In fact, you are able to change the plugin here! It is just a tiddler. A change that won’t do any harm and show immediate results is the list field. You can change the tiddler names to a new order and you will get the tabs arranged accordingly. If you would change the content of the text field, you would have to reload as explained by others before.

Have fun, be careful.
Thomas
Reply all
Reply to author
Forward
0 new messages