Ticket #913 (closed defect: duplicate)

Opened 4 years ago

Last modified 4 years ago

overwriting existing tiddlers retains the wrong set of extended fields

Reported by: FND Owned by: FND
Priority: major Milestone: 2.5.1
Component: core Version:
Severity: high Keywords:
Cc:

Description

When renaming a tiddler to match the name of (and thus overwrite) an existing tiddler, the old tiddler's extended fields are retained.

Example:
Foo has fields { foo: "lorem" } , Bar has fields { bar: "ipsum" }
renaming Foo to Bar (confirming the overwrite warning) results in tiddler Bar with fields { bar: "ipsum" } instead of the expected { foo: "lorem" }

Attachments

ticket913_testcase.html Download (286.7 KB) - added by FND 4 years ago.

Change History

Changed 4 years ago by FND

Changed 4 years ago by FND

This appears to be caused by the following section in Tiddler.prototype.assign:

if(fields != undefined)
	this.fields = fields;

Changed 4 years ago by SaqImtiaz

Testing shows that there is no such error in either Store.prototype.saveTiddler nor Tiddler.prototype.assign.

Tiddler.prototype.assign correctly assigns the fields passed to it unless the value is undefined, in which is case they should not be assigned.

Console.log calls at the beginning and end of the store.saveTiddler function show that the fields passed to it are the ones assigned to the tiddler it returns, with the exception of the changeCount which is increased as it should be.

Changed 4 years ago by FND

  • status changed from new to closed
  • resolution set to duplicate

Saq is correct; while this bug only takes effect in Tiddler.prototype.assign, it actually originates in Story.prototype.saveTiddler passing the wrong extendedFields to TiddlyWiki.prototype.saveTiddler.

marked as duplicate of #912

Note: See TracTickets for help on using tickets.