Im filtering menu array by permission once user logged in.
Im generating static menu and then give copy of array to filter.
constructor(public menu: MenuService, public permissionService: PermissionService) {
    console.log(menu.getMenu()) // this changes after filtering below
    this.menuItems = this.permissionService.filterMenuByTopic([...menu.getMenu()]); // here I'm using a copy
  }
Why do this happen ? If I have used spread operator and I do not use original array [...menu.getMenu()].
Only If I refresh the pages menu.getMenu() returns to original value
UPD 1
answering to the comments , here is getMenu() func
import { Injectable } from '@angular/core';
@Injectable()
export class MenuService {
  menuItems: Array<any>;
  constructor() {
    this.menuItems = [];
  }
  addMenu(items: Array<{
    text: string,
    heading?: boolean,
    link?: string,     // internal route links
    elink?: string,    // used only for external links
    target?: string,   // anchor target="_blank|_self|_parent|_top|framename"
    icon?: string,
    alert?: string,
    submenu?: Array<any>
  }>) {
    items.forEach((item) => {
      this.menuItems.push(item);
    });
  }
  getMenu() {
    return this.menuItems;
  }
}
 
    