It came to our attention recently through this forum post that there is a small bug in the Repeater control of WinJS 2.0 (Windows 8.1). I wanted to summarize my response to that post here.

The bug occurs when you change either the template or data property of the repeater and results in an enigmatic “NotFoundError” deep down inside the ui.js file of WinJS. It specifically occurs when the repeater’s template is set to a separately-declared WinJS.Binding.Template control. What happens is that when you change either template or data property of the control, it disposes its prior contents before rendering the new, but ends up trying to remove the same child node twice (hence the error).

Fortunately there are three ways to work around the bug:

  1. Instead of using a separately-declared template, place the template directly inline as the child of the repeater element.
  2. For a separately-declared template, use data-win-options=”{ extractChild: ‘true’ }” on the same element as data-win-control=”WinJS.Binding.Template”.
  3. Recreate the Repeater control whenever you change the template or data source (which is a more expensive operation of course).

See the original forum post for applicable code snippets.

[Correction: #2 above originally had WinJS.UI.Repeater, which should be WinJS.Binding.Template as modified.]