Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Issue with example tiddlywiki #14

Open
BlakeTacklind opened this issue Jun 6, 2020 · 6 comments
Open

Minor Issue with example tiddlywiki #14

BlakeTacklind opened this issue Jun 6, 2020 · 6 comments

Comments

@BlakeTacklind
Copy link

I have noticed a minor issue with the example for push in the example wiki.

The count is always displaying 0. I think it should be: [all[current]get[messages-target]indexes[/2]count[]]

@BlakeTacklind
Copy link
Author

Also when using the tm-json-push action, you have the set param, which creates a new tiddler. That seems a little weird to me and I don't see that behavior documented.

@joshuafontany
Copy link
Owner

joshuafontany commented Jun 6, 2020

I have noticed a minor issue with the example for push in the example wiki.

The count is always displaying 0. I think it should be: [all[current]get[messages-target]indexes[/2]count[]]

Hi @BlakeTacklind ,

Thanks, great catch on the Push example tiddler! This is actually a bug from a change I made with the indexes[] operator, which now returns the root indexes unless you use the "all" suffix, like so indexes:all[]. With that, the parameter can be either [/2] or [/2/] and it will give an accurate Count.

I will get that tested and updated in the example wiki. Looking at your next comment now.

@BlakeTacklind
Copy link
Author

The second comment is something that happens in the example wiki as well. Tested on windows & Linux Firefox and Windows Chrome

@joshuafontany
Copy link
Owner

joshuafontany commented Jun 6, 2020

Ah, yes the set parameter (which could have been named better) allows you to store the length of the new array in a TextReference (TiddlerTitle, Title!!field, or Title##index) as part of the Push action. I simply modeled this on the Javascript function's output, not wanting to loose the data returned. So you give set a TextReference, which could be an existing title/field/index or a new one. If it is a new title/field/index the core Wiki methods for processing setTextReference() go ahead and create it.

Because the wiki refreshes any content that is "bound" to a TextReference, you can have that TextReference in other widgets/places in the wiki, which will update on the "Count" changing, if you need to trigger or render something based on that independent of the contents of the Array in question. That's probably why I called it "set"....

@joshuafontany
Copy link
Owner

Also, appreciate you testing this plugin! Mahalo (thanks) for the feedback. :)

@BlakeTacklind
Copy link
Author

Ah, I hate throwing away data as well. I mean the computer spent so many cycles to make it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants