backbone.marionette icon indicating copy to clipboard operation
backbone.marionette copied to clipboard

Region reset called during view render does not clear the region.el when needed

Open JSteunou opened this issue 7 years ago • 3 comments

Description

Kind of tricky but this is the use case:

  1. Create a view
  2. Manually init a region with a node element as el
  3. re-render the view
  4. region reset is invoked, emptying the region, but keeping the el
  5. try to showChildView on each view onRender => 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

JSteunou avatar Nov 14 '17 09:11 JSteunou

@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.

JSteunou avatar Nov 14 '17 09:11 JSteunou

Fix & use case with auto region https://github.com/marionettejs/backbone.marionette/pull/3530/commits/66408146642e69df71002835fe92f0b8c6546744

JSteunou avatar Nov 14 '17 09:11 JSteunou

I think this will be resolved in the new region work

paulfalgout avatar Apr 29 '19 11:04 paulfalgout