databind-js icon indicating copy to clipboard operation
databind-js copied to clipboard

Issue with delayed-loaded view on a repeater

Open ken107 opened this issue 4 years ago • 1 comments

<div bind-repeater-if="#item ? 1 : 0" bind-view="Item">

If the view is ready at the time of binding, then no problem. However if it is not ready, we automatically create a boolean repeater in-place to represent its delayed loading state. This results in coincident repeaters.

We currently cannot handle coincident repeaters. Each repeater needs an anchor against which to attach the spawned elements. The second repeater wrongly uses the first repeater's ephemeral container as anchor.

ken107 avatar Jul 08 '21 23:07 ken107

We want to allow dynamic view loading, this means readiness of a view at the time of binding is unpredictable. If bind-repeater and bind-view are allowed on the same element, coincident-repeater errors will happen unpredictably. Thus, we must either disallow bind-repeater and bind-view on the same element, or make coincident repeaters work.

Coincident repeaters, i.e. two or more bind-repeater directives on the same element, generally do not make sense. The repeaters should instead be nested, like TDs inside TRs, for proper multidimensional structuring. The solution thus could simply be to convert coincident repeaters to nested repeaters automatically.

ken107 avatar Jul 09 '21 04:07 ken107