New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preloaded recursive views fail to render their recursions #439

Merged
merged 1 commit into from Jul 10, 2013

Conversation

Projects
None yet
1 participant
@andykant
Contributor

andykant commented Jun 27, 2013

Whenever a recursive can.view is stolen (or preloaded via production build) prior to being used in the page, it will only render the top level pass, ignoring all recursions.

This will fail (where indirect1 and indirect2 recursively call each other inside their templates):

    steal(
        'view/ejs/test/indirect1.ejs', 
        'view/ejs/test/indirect2.ejs',
        function() {
            var unordered = new can.Observe.List([
                { ol: [
                    { ul: [
                        { ol: [1, 2, 3] }
                    ]}
                ]}
            ]);
            can.view.cache = false;
            var div = document.createElement('div');    
            div.appendChild(can.view(can.test.path('view/ejs/test/indirect1.ejs'), {unordered: unordered}));
            document.getElementById('qunit-test-area').appendChild(div);
            var el = can.$('#qunit-test-area ul > li > ol > li > ul > li > ol > li')[0];
            ok(!!el && can.trim(el.innerHTML) === "1", "Uncached indirectly recursive EJS working.");

            can.view.cache = true;
            div.appendChild(can.view(can.test.path('view/ejs/test/indirect1.ejs'), {unordered: unordered}));
            el = can.$('#qunit-test-area ul + ul > li > ol > li > ul > li > ol > li')[0];
            ok(!!el && can.trim(el.innerHTML) === "1", "Cached indirectly recursive EJS working.");
            document.getElementById('qunit-test-area').removeChild(div);
        }
    );

I will be checking in a fix shortly.

@ghost ghost assigned andykant Jun 27, 2013

andykant added a commit that referenced this pull request Jul 10, 2013

Merge pull request #439 from bitovi/recursive-preloaded-views
Preloaded recursive views fail to render their recursions

@andykant andykant merged commit 9e38822 into master Jul 10, 2013

@andykant andykant deleted the recursive-preloaded-views branch Jul 10, 2013

@andykant andykant removed their assignment Oct 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment