NOTE: This proposal only applies to older versions of Tapestry.

Problem Description

It would be nice to allow the user to reference a component multiple times. This is often the case for simple components (like Insert or DirectLink) that may be duplicated many times.

Sure, Tapestry supports the copy-of attribute, but ti would be nicer to just allow it.

Proposed Solution

Current duplicated component ids in the HTML template are considered errors.

Tapestry should be changed to quietly make a duplicate ... copy the existing component's type and parameters, then overlay with any parameters provided in the HTML template. This would create a new, distinct component, with a new and unique component id (probably something like mycomponent$0.

Very little downside to this, unless the component performs an expensive operation or stores persistent state, in which case the behavior might not quite match what an (inexperienced?) user would predict.

Discussion

  • No labels