Custom View tearDown not being called when component is "rendered out"

When a custom view is visible (e.g. Table custom view), if the component (e.g. table) is “rendered out”, the tearDown function is not being called.

This leads to the inability to “cleanup” (e.g. unregister/remove/destroy) resources that the view has created/registered/etc. Unfortunately, it is not possible to override the list or editor of a table in this case because the view doesn’t “own” the editor/list and overriding these methods would impact those resources. In short, there is no way to reliably “cleanup” a custom view when conditionally rendered “out”.

Steps to reproduce

  1. Create page using XML below
  2. Preview page
  3. Change to “Basic” view
  4. Change to “List” View

Expected Behavior = Actual Behavior
tearDown is called (see console message)

  1. Change to “Basic” view
  2. Toggle the “HideTable” field above the table to

Expected Behavior
tearDown is called when table is rendered “out”

Actual Behavior
tearDown is NOT called when table is rendered “out”

Sample Page

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true" tabtooverride="Product2">   <models>
      <model id="Product2" limit="100" query="true" createrowifnonefound="false" sobject="Product2" adapter="" type="">
            <field id="Name"/>
            <field id="CreatedDate"/>
            <field id="Id"/>
            <field id="Description"/>
            <field id="Family"/>
            <field id="ProductCode"/>
      <model id="Tracker" limit="1" query="false" createrowifnonefound="true" adapter="" type="" doclone="" sobject="Account">
            <field id="HideTable" uionly="true" displaytype="BOOLEAN" label="HideTable"/>
      <pagetitle model="Product2" uniqueid="sk-jswKP-68">
            <action type="savecancel"/>
      <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="Tracker" buttonposition="" uniqueid="sk-uhxOb-780" mode="edit">
            <column width="100%">
                  <section title="Section A" collapsible="no" showheader="false">
                        <field id="HideTable" valuehalign="" type=""/>
      <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Product2" mode="edit" uniqueid="sk-jswKP-69" emptysearchbehavior="query" buttonposition="">
            <field id="Name" allowordering="true"/>
            <field id="CreatedDate" allowordering="true"/>
            <action type="edit"/>
            <action type="delete"/>
         <massactions usefirstitemasdefault="true"/>
            <view type="standard"/>
            <view type="custom" label="Basic" viewsnippet="basicView" icon="sk-icon-config"/>
         <renderconditions logictype="and">
            <rendercondition type="fieldvalue" enclosevalueinquotes="false" fieldmodel="Tracker" sourcetype="fieldvalue" nosourcerowbehavior="skipandnorender" sourceproperty="hasChanged" value="true" operator="!=" field="HideTable"/>
         <jsitem location="inline" name="newInlineJS" cachelocation="false" url="">(function($, $S){
    $S.snippet.registerSnippet('basicView', function() {
        function setUp( list )
            //console.log( 'setUp was called');
        function beforeRender( list )
            //console.log( 'beforeRender was called');            
        function render( item )
            //console.log( 'render was called');
            item.element.text( item.row.Name );
        function renderComplete( list )
            //console.log( 'renderComplete was called');
        function tearDown( list )
            console.log( 'tearDown was called - ' + Math.random());
        return {
            render: render,
            setUp: setUp,
            beforeRender: beforeRender,
            renderComplete: renderComplete,
            tearDown: tearDown
})(skuid.$, skuid);</jsitem>
      <styleitem type="background" bgtype="none"/>