<commit_before>import { Component, OnInit } from '@angular/core';
import { UserInfoStore } from '../../core/user/user-info.store';
import { ActivatedRoute } from '@angular/router';
import { PublicSnippetsService } from './public-snippets.service';
import { Observable } from 'rxjs';
import { Codelet } from '../../core/model/codelet';

@Component({
  selector: 'app-public-snippet-details',
  templateUrl: './public-snippet-details.component.html'
})
export class PublicSnippetDetailsComponent implements OnInit {
  snippetId: string;
  snippet$: Observable<Codelet>;

  constructor(
    private publicSnippetsService: PublicSnippetsService,
    private userInfoStore: UserInfoStore,
    private route: ActivatedRoute) {
  }

  ngOnInit() {
    this.snippetId = this.route.snapshot.paramMap.get('id');
    this.snippet$ = this.publicSnippetsService.getPublicSnippetById(this.snippetId);
  }

}<commit_msg>refactor(fe): use async retrieval of path param in public-snippet-details.component.ts<commit_after>import { Component, OnInit } from '@angular/core';
import { UserInfoStore } from '../../core/user/user-info.store';
import { ActivatedRoute } from '@angular/router';
import { PublicSnippetsService } from './public-snippets.service';
import { Observable } from 'rxjs';
import { Codelet } from '../../core/model/codelet';
import { switchMap } from 'rxjs/operators';

@Component({
  selector: 'app-public-snippet-details',
  templateUrl: './public-snippet-details.component.html'
})
export class PublicSnippetDetailsComponent implements OnInit {
  snippetId: string;
  snippet$: Observable<Codelet>;

  constructor(
    private publicSnippetsService: PublicSnippetsService,
    private userInfoStore: UserInfoStore,
    private route: ActivatedRoute) {
  }

  ngOnInit() {
    this.snippet$ = this.route.paramMap.pipe(
      switchMap(params => {
        this.snippetId = params.get('id');
        return this.publicSnippetsService.getPublicSnippetById(this.snippetId);
      })
    );
  }

}
{'fraction_non_alphanumeric': 0.13440320962888666, 'fraction_numerical': 0.0, 'mean_word_length': 4.435967302452316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '938628', 'n_tokens_mistral': 600, 'n_tokens_neox': 588, 'n_words': 123}