Long time running script while binding a view ? MV

2019-08-24 17:45发布

问题:

I been through lot of articles and i cant find anything suits the scenario

I have been getting Long time ruuning script which is i am unable to get rid of it .

I tried many ways to find out is there any continuous loop running in my script and i find nothing the Total time it took to load is a matter of 5 sec

Later its trying to bind to view then here we go i get this issue its taking lot of time and once i click on stop script i can see data perfectly .

My view :

<table  data-bind="foreach:$root.MAINDATA">

    <tr>
        <td>
                @Html.Partial("Header");
        </td>
    </tr>

    <tr>
         <td>
             <table>

                 <tr >
                     <td data-bind="foreach:$data.Data2"> 

                        <!-- ko if:Id === 1 -->
                          @Html.Partial("ONE") 
                         <!-- /ko -->

                         <!-- ko if:Id === 2 -->
                          @Html.Partial("TWO") 
                         <!-- /ko -->

                         <!-- ko if:Id === 4 -->
                          @Html.Partial("THREE")
                         <!-- /ko -->

                          <!-- ko if:Id === 5 -->
                          @Html.Partial("FOUR")
                         <!-- /ko -->
                          <!-- ko if:Id === 6 -->
                         @Html.Partial("FIVE")
                         <!-- /ko -->
                            <!-- ko if:Id === 7 -->
                         @Html.Partial("SIX")
                         <!-- /ko -->

                          <!-- ko if:Id === 8 -->
                         @Html.Partial("SEVEN")
                         <!-- /ko -->
                     </td>
                 </tr>
             </table>
         </td>
    </tr>


</table>

Well this is my main view and yes in deed it looks complex and each @Html.Partial(//) will have a views with 3 level deeper data-bind:foreach:$data2 --> data-bind:foreach:$data3 -- > My controls to show my view excatly .

See the way i am doing and building my MAINDATA observable array(it takes similar for loop structure with 7-10 ajax calls based on condition as in view) i just replicated to bind back to view .

I have no clue or whatsoever why this one is happening and people around me suggested there may be a infinate loops blah blah i tried that but cant find anything .

My observation :

Do correct me if i'm wrong i believe when browser show loading means its tend to say proccess is happening in script-controller but after 5sec there is no sign of browser showing any loading symbol and i get no display browser gets hanged when i click on ir i get stop script like that . I have to go with my gut feeling and say there is a issue while binding my view .

Any help is most appreciated .