Problem with 0.9 version and subcategories on main page



  • Hi, I have a little problem with new nodebb 0.9 version.

    On my forum I show the subcategories on the main page, so that people can see the whole forum:

    With the new version, I get that error (and it stop working):

    13/11 00:31 [21643] - error: RangeError: Maximum call stack size exceeded

    Looks like something is wrong, now, but I don't get why


  • Plugin & Theme Dev

    @ffmad it's because of a change in the way templates.js processes conditionals in theme template files. Make sure the conditionals in your theme are in proper format.

    For example:
    If you have a condition like this <!-- IF categories -->
    Make sure there is a space after <!-- and there is a space before -->


  • Admin

    If you have a custom theme make sure you don't have any invalid syntax in the templates. Specifically check for whitespace missing in <!-- BEGIN someArray --> and <!-- IF someCondition --> blocks.


  • Admin

    ^^ what he said :)



  • @baris @pichalite

    Is there a problem in this code ?

    <div class="subcategories-list col-md-12 col-sm-12 col-xs-12">
    	<div class="col-md-6 col-sm-9 col-xs-12 content">
    	<!-- IF ../children.length --><p>[[category:subcategories]]</p><!-- ENDIF ../children.length -->
    	</div>
    	<!-- BEGIN ../children -->
    	TEST
    	<!-- END ../children -->
    </div>
    

    the IF is working well, but the begin/end isn't

    edit: it really is a syntax problem, as it's still not working even with no subcategories

    RangeError: Maximum call stack size exceeded
        at String.match (native)
        at checkConditional (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:221:26)
        at checkConditionals (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:217:27)
        at parseValue (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:383:14)
        at parse (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:402:17)
        at cleanup (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:473:27)
        at parse (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:419:15)
        at cleanup (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:473:27)
        at parse (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:419:15)
        at cleanup (/var/www/html/CryptoFR-v3.3/node_modules/templates.js/lib/templates.js:473:27)
    


  • solved it ... by putting the code in an other template ... I still don't understand why, but it works 😬


  • Admin

    Let us know what the new code looks like :)


  • GNU/Linux

    This is cool as heck, could you share the code used to achieve this? I'm interested in having this on my forum as well :)



  • @julian said:

    Let us know what the new code looks like :)

    In fact, it's still not working ...

    I've moved the code to "item", but there even if it's displayed, there is still the same error in the console, and it breaks other pages

    @Marc-Boisvert-Dupras

    When it works, I can do that ^^

    In a former version (0.7.0 I think), I've made a change so that the subcategories were showing as unread or not. Not working since 0.8.2, but that something I will try to put back online again

    (my test website: http://151.80.135.39/)



  • @ffmad I'd be intrested in know how you have done that as well, as the only way I found to do it in 0.7.1 was to hack the categories.js file around, now that has changed in 0.9.0



  • @uncle_muddy said:

    @ffmad I'd be intrested in know how you have done that as well, as the only way I found to do it in 0.7.1 was to hack the categories.js file around, now that has changed in 0.9.0

    I've done the same in 0.7.1

    Finally, I've used javascript to do what I wanted :)


  • GNU/Linux

    @ffmad Looking good :)



  • @ffmad said:

    I add the following code to item.tpl of persona

    <!-- IF ../children.length -->
    <!-- BEGIN ../children -->
    <!-- END ../children -->
    <!-- ENDIF ../children.length -->

    but it produces this error error: RangeError: Maximum call stack size exceeded
    please help me check



  • I've just downgrade template.js in nodebb to 0.2.8 then it works


  • Admin

    @thuanpq-io No need to wrap it in conditional, BEGIN won't do anything if the array is empty.



  • @julian said:

    won't do anything if the array is empty

    I guess the problem is that latest release of template.js does not allow another the loop inside a template, then I have to declare that loop in another template and include into my item.tpl


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.