Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ import { toDisplayText } from '../../../../shared/to-display-text';
}
`,
template: `
@if (label() || value()) {
@if (displayValue()) {
<div class="row">
<span class="row__label">{{ label() }}:</span>
<span class="row__value">{{ value() }}</span>
<span class="row__value">{{ displayValue() }}</span>
</div>
} @else if (loading()) {
<div class="sr-skeleton" style="height: 11px; width: 100%; margin: 3px 0;"></div>
Expand All @@ -49,6 +49,9 @@ import { toDisplayText } from '../../../../shared/to-display-text';
class DemoValueComponent {
readonly label = input('');
readonly value = input<unknown>('');
// Coerce through toDisplayText so an unresolved binding object mid-stream
// (e.g. a partial `$computed` value) renders as the skeleton, not `[object Object]`.
readonly displayValue = computed(() => toDisplayText(this.value()));
readonly childKeys = input<string[]>([]);
readonly spec = input<Spec | null>(null);
readonly bindings = input<Record<string, string>>({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class DemoHeadingComponent {
}
`,
template: `
@if (label() || value()) {
@if (displayValue()) {
<div class="row">
<span class="row__label">{{ label() }}:</span>
<span class="row__value">{{ value() }}</span>
<span class="row__value">{{ displayValue() }}</span>
</div>
} @else if (loading()) {
<div class="sr-skeleton" style="height: 11px; width: 100%; margin: 3px 0;"></div>
Expand All @@ -97,6 +97,7 @@ class DemoHeadingComponent {
class DemoLabelComponent {
readonly label = input('');
readonly value = input('');
readonly displayValue = computed(() => toDisplayText(this.value()));
readonly childKeys = input<string[]>([]);
readonly spec = input<Spec | null>(null);
readonly bindings = input<Record<string, string>>({});
Expand Down
Loading