backbone.marionette
backbone.marionette copied to clipboard
Region reset called during view render does not clear the region.el when needed
Description
Kind of tricky but this is the use case:
- Create a view
- Manually init a region with a node element as el
- re-render the view
- region reset is invoked, emptying the region, but keeping the el
- try to
showChildView
on each viewonRender
=> fail because region.el does not exists anymore
Expected behavior
Region el should be cleaned on reset if the reset is after a view render aka el do not exists in the DOM anymore
Actual behavior
Region el is kept, which lead to error on consecutive render
@marionettejs/marionette-core this is an actual issue for auto-region next feature and I dont know if this issue should be address today by Marionette or just document as good practice to user like "Always reset your region.el after view render" or just fix solely for and in next region.
Fix & use case with auto region https://github.com/marionettejs/backbone.marionette/pull/3530/commits/66408146642e69df71002835fe92f0b8c6546744
I think this will be resolved in the new region work