fix(layer-editor): use stable _key for drag-and-drop sorting
Add a unique `_key` to each layer config to maintain stable sortable IDs across reorder operations. Update LayerRow to use the sortableId prop and the `use:sortable` directive. Refactor layer-crud utilities to generate and propagate `_key` values on creation and initialization.
This commit is contained in:
@@ -463,8 +463,12 @@ export function createDeckStore(initialSrc: string = ""): DeckStore {
|
||||
setState({
|
||||
cards: data,
|
||||
activeTab: 0,
|
||||
frontLayerConfigs: initLayerConfigsForSide(data, layersStr),
|
||||
backLayerConfigs: initLayerConfigsForSide(data, backLayersStr),
|
||||
frontLayerConfigs: layerCrud.withKeys(
|
||||
initLayerConfigsForSide(data, layersStr),
|
||||
),
|
||||
backLayerConfigs: layerCrud.withKeys(
|
||||
initLayerConfigsForSide(data, backLayersStr),
|
||||
),
|
||||
isLoading: false,
|
||||
});
|
||||
updateDimensions();
|
||||
|
||||
Reference in New Issue
Block a user