@s-libs/signal-store
    Preparing search index...

    Function spreadArrayStoreNew

    • Return an array of store objects, one for each element in source's state. The emitted arrays will have references to the exact store objects included in the previous emission when possible, making them performant for direct comparison in change detection.

      @Component({
      imports: [HeroComponent],
      template: `
      @for (heroStore of heroStores(); track heroStore) {
      <app-hero [heroStore]="heroStore" />
      }
      `,
      })
      class HeroListComponent {
      readonly heroesStore = input.required<Store<Hero[]>>();
      protected readonly heroStores = computed(() =>
      spreadArrayStoreNew(this.heroesStore()),
      );
      }

      Type Parameters

      • T extends undefined | null | any[]

      Parameters

      Returns Slice<T, number>[]

    • Return an array of store objects, one for each element in source's state. The emitted arrays will have references to the exact store objects included in the previous emission when possible, making them performant for direct comparison in change detection.

      @Component({
      imports: [HeroComponent],
      template: `
      @for (heroStore of heroStores(); track heroStore) {
      <app-hero [heroStore]="heroStore" />
      }
      `,
      })
      class HeroListComponent {
      readonly heroesStore = input.required<Store<Hero[]>>();
      protected readonly heroStores = computed(() =>
      spreadArrayStoreNew(this.heroesStore()),
      );
      }

      Type Parameters

      • T extends undefined | null | any[]

      Parameters

      Returns ReadonlySlice<T, number>[]