Ticket #1205 (closed defect: fixed)
"fields" param in store.saveTiddler() is mutable
| Reported by: | mahemoff | Owned by: | FND |
|---|---|---|---|
| Priority: | undefined | Milestone: | 2.6 |
| Component: | core | Version: | |
| Severity: | undefined | Keywords: | |
| Cc: |
Description
ref http://groups.google.com/group/tiddlywikidev/t/c7ead191393341f1?hl=en
If i call store.saveTiddler(), specifying a value for the
fields map paameter, the value is assigned directly rather than being cloned.
i.e.: var fields = { hot: true }; var tid = store.saveTiddler(......., fields, ......); tid.hot = false; // now fields.hot is false too
This bit me when I passed in config.defaultCustomFields; it turned out TiddlyWebAdaptor? was setting "server.title" on each tiddler, and this was magically appearing on config.defaultCustomFields (where it would be applied to subsequent tiddlers).
I am thinking it would be nice if the fields argument was cloned by store.saveTiddler(). Interested in others' thoughts on that.
