Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(addon-doc): DocAPIItem throws error for signal-based output handlers #10292

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions projects/addon-doc/components/api/api-item.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Location, NgForOf, NgIf, NgSwitch, NgSwitchCase} from '@angular/common';
import type {OnInit} from '@angular/core';
import type {AfterViewInit} from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
Expand Down Expand Up @@ -49,7 +49,7 @@ const SERIALIZED_SUFFIX = '$';
styleUrls: ['./api-item.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TuiDocAPIItem<T> implements OnInit {
export class TuiDocAPIItem<T> implements AfterViewInit {
private readonly locationRef = inject(Location);
private readonly activatedRoute = inject(ActivatedRoute);
private readonly urlSerializer = inject(UrlSerializer);
Expand All @@ -71,7 +71,7 @@ export class TuiDocAPIItem<T> implements OnInit {
@Output()
public readonly valueChange = new EventEmitter<T>();

public ngOnInit(): void {
public ngAfterViewInit(): void {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or should it be constructor? Since it's a snapshot that doesn't change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, i'll investigate it!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waterplea

Unfortunately, this function also uses input properties – constructor is not an option

@Input()
public name = '';

private parseParams(params: Params): void {
const name = this.clearBrackets(this.name);

this.parseParams(this.activatedRoute.snapshot.queryParams);
}

Expand Down
Loading