BEES
06/09/2026, 8:58 AMRavi
06/09/2026, 9:40 AMRavi
06/09/2026, 9:41 AMRavi
06/09/2026, 9:42 AM)}
// Over this
${this._model.map(item => html...`)}
Without stable keys, Lit recycles DOM nodes in ways that confuse the sorter's internal node↔item map.BEES
06/09/2026, 9:43 AMBEES
06/09/2026, 9:43 AMprivate _initializeSorter(model: Field[]) {
if (this.sorter) {
this.sorter.destroy()
}
this.sorter = new UmbSorterController<Field>(this, {
itemSelector: '.sorter-item',
containerSelector: '.sorter-container',
getUniqueOfElement: (element) => {
return element.getAttribute('data-sorter-id')
},
getUniqueOfModel: (modelEntry) => {
return modelEntry.id
},
onChange: async ({ model }) => {
const context = await this.getContext(FormsEditorContext_TOKEN)
if (!context) {
return
}
const newFieldSets = this.page.fieldSets.map((fieldSet) => ({
...fieldSet,
containers: fieldSet.containers.map((container) => ({
...container,
fields: [...model],
})),
}))
context.updatePage(this.page.id, {
fieldSets: newFieldSets,
})
},
})
this.sorter.setModel(model)
}BEES
06/09/2026, 9:45 AMRavi
06/09/2026, 10:47 AMBEES
06/09/2026, 11:14 AMRavi
06/09/2026, 7:11 PMRavi
06/09/2026, 7:14 PMBEES
06/10/2026, 9:34 AMBEES
06/10/2026, 9:34 AMRavi
06/10/2026, 9:42 AMBEES
06/10/2026, 9:47 AM