Skip to content

Commit f37bd8d

Browse files
janechuCopilot
andcommitted
fix: isolate chained callbacks and fix TSDoc links
- chainCallback() now invokes each callback in its own try/catch so a throwing first callback cannot suppress the second - Replace {@link enableHydration} with plain text in declarative TSDoc to avoid ae-unresolved-link warnings in doc:exports:ci Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent dad7c2d commit f37bd8d

5 files changed

Lines changed: 20 additions & 12 deletions

File tree

packages/fast-element/SIZES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bundle sizes for `@microsoft/fast-element` exports.
44

55
| Export | Minified | Gzip | Brotli |
66
|--------|----------|------|--------|
7-
| CDN Rollup Bundle | 65.04 KB | 19.35 KB | 17.30 KB |
7+
| CDN Rollup Bundle | 65.07 KB | 19.35 KB | 17.29 KB |
88
| FASTElement | 23.71 KB | 7.37 KB | 6.63 KB |
99
| Updates | 473 B | 337 B | 287 B |
1010
| Observable | 6.70 KB | 2.49 KB | 2.22 KB |
@@ -19,6 +19,6 @@ Bundle sizes for `@microsoft/fast-element` exports.
1919
| repeat | 29.57 KB | 9.42 KB | 8.47 KB |
2020
| css | 2.43 KB | 1.00 KB | 911 B |
2121
| ElementStyles | 1.65 KB | 729 B | 623 B |
22-
| enableHydration | 43.21 KB | 13.20 KB | 11.88 KB |
22+
| enableHydration | 43.23 KB | 13.21 KB | 11.88 KB |
2323
| ArrayObserver | 12.51 KB | 4.45 KB | 4.01 KB |
24-
| declarativeTemplate | 85.65 KB | 26.21 KB | 23.10 KB |
24+
| declarativeTemplate | 85.68 KB | 26.22 KB | 23.09 KB |

packages/fast-element/src/components/hydration-tracker.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,15 @@ function chainCallback(
9595
if (!first) return second;
9696
if (!second) return first;
9797
return () => {
98-
first();
99-
second();
98+
try {
99+
first();
100+
} catch {
101+
// Isolate callbacks so one consumer cannot suppress another.
102+
}
103+
try {
104+
second();
105+
} catch {
106+
// Isolate callbacks so one consumer cannot suppress another.
107+
}
100108
};
101109
}

packages/fast-element/src/declarative/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ export interface ElementOptionsDictionary<ElementOptionsType = ElementOptions> {
118118
* This interface combines template lifecycle callbacks with
119119
* global hydration events. It is accepted by
120120
* {@link TemplateElement.config} for backward compatibility.
121-
* New code should prefer {@link enableHydration} for global
121+
* New code should prefer `enableHydration()` for global
122122
* hydration events and pass per-element callbacks directly to
123123
* {@link declarativeTemplate}.
124124
*
125-
* @deprecated Use {@link enableHydration} and {@link declarativeTemplate} callbacks instead.
125+
* @deprecated Use `enableHydration()` and {@link declarativeTemplate} callbacks instead.
126126
* @public
127127
*/
128128
export interface HydrationLifecycleCallbacks extends TemplateLifecycleCallbacks {

sites/website/src/docs/3.x/api/fast-element/declarative/fast-element.hydrationlifecyclecallbacks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ navigationOptions:
1717

1818
> Warning: This API is now obsolete.
1919
>
20-
> Use and [declarativeTemplate()](../fast-element.declarativetemplate/) callbacks instead.
20+
> Use `enableHydration()` and [declarativeTemplate()](../fast-element.declarativetemplate/) callbacks instead.
2121
>
2222
2323
Lifecycle callbacks for template events.
@@ -31,7 +31,7 @@ export interface HydrationLifecycleCallbacks extends TemplateLifecycleCallbacks
3131
3232
## Remarks
3333
34-
This interface combines template lifecycle callbacks with global hydration events. It is accepted by [TemplateElement.config()](../fast-element.templateelement.config/) for backward compatibility. New code should prefer for global hydration events and pass per-element callbacks directly to [declarativeTemplate()](../fast-element.declarativetemplate/)<!-- -->.
34+
This interface combines template lifecycle callbacks with global hydration events. It is accepted by [TemplateElement.config()](../fast-element.templateelement.config/) for backward compatibility. New code should prefer `enableHydration()` for global hydration events and pass per-element callbacks directly to [declarativeTemplate()](../fast-element.declarativetemplate/)<!-- -->.
3535
3636
## Methods
3737

sites/website/src/docs/3.x/resources/export-sizes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Bundle sizes for `@microsoft/fast-element` exports.
1919

2020
| Export | Minified | Gzip | Brotli |
2121
|--------|----------|------|--------|
22-
| CDN Rollup Bundle | 65.04 KB | 19.35 KB | 17.30 KB |
22+
| CDN Rollup Bundle | 65.07 KB | 19.35 KB | 17.29 KB |
2323
| FASTElement | 23.71 KB | 7.37 KB | 6.63 KB |
2424
| Updates | 473 B | 337 B | 287 B |
2525
| Observable | 6.70 KB | 2.49 KB | 2.22 KB |
@@ -34,6 +34,6 @@ Bundle sizes for `@microsoft/fast-element` exports.
3434
| repeat | 29.57 KB | 9.42 KB | 8.47 KB |
3535
| css | 2.43 KB | 1.00 KB | 911 B |
3636
| ElementStyles | 1.65 KB | 729 B | 623 B |
37-
| enableHydration | 43.21 KB | 13.20 KB | 11.88 KB |
37+
| enableHydration | 43.23 KB | 13.21 KB | 11.88 KB |
3838
| ArrayObserver | 12.51 KB | 4.45 KB | 4.01 KB |
39-
| declarativeTemplate | 85.65 KB | 26.21 KB | 23.10 KB |
39+
| declarativeTemplate | 85.68 KB | 26.22 KB | 23.09 KB |

0 commit comments

Comments
 (0)