TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.97k stars 1.18k forks source link

$tw.utils.stringifyList should not discard empty values #1451

Open tobibeer opened 9 years ago

tobibeer commented 9 years ago

https://github.com/Jermolene/TiddlyWiki5/pull/1375#issuecomment-71924536

Hmm I wonder if one underlying problem here isn't that $tw.utils.stringifyList(["foo","","bar"]) should return foo [[]] bar and not foo bar.

pmario commented 7 years ago

Does this issue cause a problem? .. if no .. close?

tobibeer commented 6 years ago

@pmario, unfortunately, yes, see @Jermolene's comment

If you're reading a bunch of values and you want to be able to refer to a specific one, then we need to have the full array. If identical entries in the array were merged then the indices would no longer match.

The thing is, if blanks are omitted, then a certain query for values will return a shorter list than the list of titles queried for. If you now try to put together an output table, you will find two columns with a differing number of rows and so you will find it difficult to turn that into a key=>value sort of table.

Jermolene commented 6 years ago

Hi @tobibeer I'm open to changing this behaviour but I think we'd need a lot of careful testing to make sure it didn't have any unexpected impacts.

tobibeer commented 6 years ago

@Jermolene: surely. a change like this may well have unexpected side-effects and perhaps require additional enhancements to keep things flowing, backwards-compatibly, elsewhere.

Wouldn't be the first change that needed to be rolled back because all subsequently needed changes were not so trivial after all. ;-)