-
Notifications
You must be signed in to change notification settings - Fork 28
refactor(row-wrapper): use signals for internals #421
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
base: main
Are you sure you want to change the base?
refactor(row-wrapper): use signals for internals #421
Conversation
4cba1ad
to
2b862a9
Compare
readonly ariaGroupHeaderCheckboxMessage = input.required<string>(); | ||
|
||
context!: RowDetailContext<TRow> | GroupContext<TRow>; | ||
readonly context = linkedSignal<RowDetailContext<TRow> | GroupContext<TRow>>(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this can a computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned here #347 (comment)
computed won't trigger with markForCheck()
if (this.rowDiffer.diff(this.row)) { | ||
if ('group' in this.context) { | ||
this.context.group = this.row as Group<TRow>; | ||
const row = this.row(); | ||
if (this.rowDiffer.diff(row)) { | ||
if ('group' in this.context()) { | ||
this.context.set({ | ||
group: row as Group<TRow>, | ||
expanded: this.expanded(), | ||
rowIndex: this.rowIndex() | ||
}); | ||
} else { | ||
this.context.row = this.row as TRow; | ||
this.context.set({ | ||
row: row as TRow, | ||
expanded: this.expanded(), | ||
rowIndex: this.rowIndex(), | ||
disabled: this.disabled() | ||
}); | ||
} | ||
this.cd.markForCheck(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just do:
if (this.rowDiffer.diff(this.row)) {
this.cd.markForCheck();
}
projects/ngx-datatable/src/lib/components/body/body-row-wrapper.component.ts
Show resolved
Hide resolved
projects/ngx-datatable/src/lib/components/body/body-row-wrapper.component.ts
Outdated
Show resolved
Hide resolved
2b862a9
to
de24043
Compare
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
What is the new behavior?
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information: