Get ngrx selector value without subscribing

I have two states in my ngrx store, state.data and state.dataArchived. I need to copy the data from state.data into state.dataArchived without subscribing to state.data. Currently, when state.data changes, state.dataArchived changes too.

selectedSchedulingsOnPopup$ = this.store.pipe(select(selectSchedulingsByBranch));
ngOnInit() {
  this.store.dispatch(new GetDirectionsOnGraph({}));
  this.selectedSchedulingsOnPopup$.subscribe(value => {
    this.selectedSchedulingsOnPopupValue = value;
    this.store.dispatch(new GetDirectionsOnGraph(this.selectedSchedulingsOnPopupValue));
  });
}

You can copy the data from state.data into state.dataArchived by creating a new object from state.data and then dispatching an action to update state.dataArchived with the new object. Here’s an example of how to do this:

const data = { ...state.data };
this.store.dispatch(new UpdateDataArchived(data));

In this example, we’re creating a new object data using the spread operator (...) to copy all the properties from state.data. Then we’re dispatching an action (UpdateDataArchived) that will update state.dataArchived with the new object.

Note that you’ll need to create an action and reducer to handle this update.