buttonwoodcx / bcx-aurelia-reorderable-repeat

An Aurelia repeater supports drag & drop reordering automatically.
https://buttonwoodcx.github.io/doc-bcx-aurelia-dnd/reorderable-repeat
MIT License
19 stars 5 forks source link

fix: fix logic on subviews require lifecycle #13

Closed 3cp closed 5 years ago

3cp commented 5 years ago

The root cause is in ArrayRepeatStrategy, moveView and updateOverrideContext are two steps, but reorderable-repeat needs to update dnd resources after overrideContext is updated. Also, with moveView, all dnd resources need to be re-registered because of index changes, that also affects styling (css classes). More than that, when using reordering-group, addView/removeView could be called too, so need to move re-registration logic to right after instanceChanged(), with a delay to cater overrideContext update.

closes #11

3cp commented 5 years ago

@simonfox this should work. I will commit some failing tests before merging this one.

3cp commented 5 years ago

I have added the failing test which was confirmed to be fixed by this PR. Please help to review before merge thanks.

simonfox commented 5 years ago

@3cp aha, task queue good stuff! Confirm this fixes both the repro I provided and my production app.