<commit_before>import { Router } from '@angular/router';
import { CheckoutService } from './../../core/services/checkout.service';
import { getShipAddress, getOrderState } from './../reducers/selectors';
import { AppState } from './../../interfaces';
import { Store } from '@ngrx/store';
import { Address } from './../../core/models/address';
import { Observable, Subscription } from 'rxjs/Rx';
import { Component, OnInit, OnDestroy } from '@angular/core';

@Component({
  selector: 'app-address',
  templateUrl: './address.component.html',
  styleUrls: ['./address.component.scss']
})
export class AddressComponent implements OnInit, OnDestroy {

  getStateSub$: Subscription;
  stateSub$: Subscription;
  orderState: string;
  shipAddress$: Observable<Address>;

  constructor(private store: Store<AppState>,
    private checkoutService: CheckoutService,
    private router: Router) {
      this.shipAddress$ = this.store.select(getShipAddress);
      this.getStateSub$ = this.store.select(getOrderState)
        .subscribe(state => this.orderState = state);
  }

  ngOnInit() {
  }

  checkoutToPayment() {
    if (this.orderState === 'delivery') {
      this.stateSub$ = this.checkoutService.changeOrderState()
        .subscribe();
    }
    this.router.navigate(['/checkout', 'payment']);
  }

  ngOnDestroy() {
    this.getStateSub$.unsubscribe();
    this.stateSub$.unsubscribe();
  }

}
<commit_msg>unsubscribe bug fix in address component<commit_after>import { Router } from '@angular/router';
import { CheckoutService } from './../../core/services/checkout.service';
import { getShipAddress, getOrderState } from './../reducers/selectors';
import { AppState } from './../../interfaces';
import { Store } from '@ngrx/store';
import { Address } from './../../core/models/address';
import { Observable, Subscription } from 'rxjs/Rx';
import { Component, OnInit, OnDestroy } from '@angular/core';

@Component({
  selector: 'app-address',
  templateUrl: './address.component.html',
  styleUrls: ['./address.component.scss']
})
export class AddressComponent implements OnInit, OnDestroy {

  stateSub$: Subscription;
  orderState: string;
  shipAddress$: Observable<Address>;

  constructor(private store: Store<AppState>,
    private checkoutService: CheckoutService,
    private router: Router) {
      this.shipAddress$ = this.store.select(getShipAddress);
      this.stateSub$ = this.store.select(getOrderState)
        .subscribe(state => this.orderState = state);
  }

  ngOnInit() {
  }

  checkoutToPayment() {
    if (this.orderState === 'delivery') {
      this.checkoutService.changeOrderState()
        .subscribe();
    }
    this.router.navigate(['/checkout', 'payment']);
  }

  ngOnDestroy() {
    this.stateSub$.unsubscribe();
  }

}

{'fraction_non_alphanumeric': 0.15820029027576196, 'fraction_numerical': 0.0, 'mean_word_length': 3.8538732394366195, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6262470', 'n_tokens_mistral': 820, 'n_tokens_neox': 813, 'n_words': 173}