title: For loop overvalues on navigation from another page
body: <p>Good day, everyone, so when i refresh the page forcibly (ctrl + r) i'm taking exact result what i need, BUT the problem is when i'm going to another app's page and back <strong>ELSE</strong> statement fith subArray2 is going crazy and i dont undestant why (subArray1 is works good)..
  At the bottom i've pin logs</p>
  <p>The idia is if some of the item length is more then 1 ([ &quot;100&quot;, &quot;-150&quot;, &quot;11&quot;, &quot;111&quot; ], [ &quot;Debt&quot;, &quot;Salary&quot;, &quot;Credit&quot;, &quot;sdad&quot; ])
  push them to another array with a same format and later combine together.</p>
  <p>When firts call of <strong>console.log(monthlyValues[i].length)</strong> its length are <strong>[1, 4, 1, 1]</strong> at next call(going thougth pages) length is <strong>[2, 8, 2, 2]</strong> and increasing with each call</p>
  <p>data:</p>
  <pre><code>let subArray1 = [];
  let subArray2 = [];
  
  let monthlyValues = [
      [ &quot;-50&quot; ],
      [ &quot;100&quot;, &quot;-150&quot;, &quot;11&quot;, &quot;111&quot; ],
      [ &quot;-200&quot; ],
      [ &quot;290&quot; ]
  ];
  
  let categories = [
      [ &quot;Salary&quot; ],
      [ &quot;Debt&quot;, &quot;Salary&quot;, &quot;Credit&quot;, &quot;sdad&quot; ],
      [ &quot;Salary&quot; ],
      [ &quot;Investments&quot; ]
  ];
  </code></pre>
  <p>Computation:</p>
  <pre><code>for (let i = 0; i &lt; monthlyValues.length; i++) {
    if(monthlyValues[i].length == 1) {
      subArray1.push([
        {
          &quot;name&quot;: monthlyCategories[i],
          &quot;value&quot;: +monthlyValues[i] 
        }
      ])
    } else {
      for (let j = 0; j &lt; monthlyValues[i].length; j++) {
        subArray2.push({
            &quot;name&quot;: monthlyCategories[i][j], 
            &quot;value&quot;: +monthlyValues[i][j] 
          });
        };
      };
    subArray1.push(subArray2);
  };
  </code></pre>
  <p>Log of the first call: (this is what i need)</p>
  <pre><code>[
      {
          &quot;name&quot;: &quot;Debt&quot;,
          &quot;value&quot;: 100
      },
      {
          &quot;name&quot;: &quot;Salary&quot;,
          &quot;value&quot;: -150
      },
      {
          &quot;name&quot;: &quot;Credit&quot;,
          &quot;value&quot;: 11
      },
      {
          &quot;name&quot;: &quot;sdad&quot;,
          &quot;value&quot;: 111
      }
  ]
  </code></pre>
  <p>Secont log call: (this is bad one, and each time i call the page length is increaseing)</p>
  <pre><code>[
      {
          &quot;name&quot;: &quot;Salary&quot;,
          &quot;value&quot;: -50
      },
      {
          &quot;name&quot;: &quot;Salary&quot;,
          &quot;value&quot;: -50
      },
      {
          &quot;name&quot;: &quot;Debt&quot;,
          &quot;value&quot;: 100
      },
      {
          &quot;name&quot;: &quot;Salary&quot;,
          &quot;value&quot;: -150
      },
      {
          &quot;name&quot;: &quot;Credit&quot;,
          &quot;value&quot;: 11
      },
      {
          &quot;name&quot;: &quot;sdad&quot;,
          &quot;value&quot;: 111
      },
      {
          &quot;name&quot;: &quot;Debt&quot;,
          &quot;value&quot;: 100
      },
      {
          &quot;name&quot;: &quot;Salary&quot;,
          &quot;value&quot;: -150
      },
      {
          &quot;name&quot;: &quot;Credit&quot;,
          &quot;value&quot;: 11
      },
      {
          &quot;name&quot;: &quot;sdad&quot;,
          &quot;value&quot;: 111
      },
      {
          &quot;name&quot;: &quot;Salary&quot;,
          &quot;value&quot;: -200
      },
      {
          &quot;name&quot;: &quot;Salary&quot;,
          &quot;value&quot;: -200
      },
      {
          &quot;name&quot;: &quot;Investments&quot;,
          &quot;value&quot;: 290
      },
      {
          &quot;name&quot;: &quot;Investments&quot;,
          &quot;value&quot;: 290
      }
  ]
  </code></pre>