Skip to content

Commit 1f27d70

Browse files
committed
fix(multiple): wrap ngDevMode check around afterRenderEffect in aria primitives
Moving the ngDevMode check outside of afterRenderEffect ensures the effect is not registered at all in production, rather than registering an effect that does nothing. Affected packages: aria/listbox, aria/toolbar
1 parent 454ff0f commit 1f27d70

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/aria/listbox/listbox.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ export class Listbox<V> {
159159
this._popup._controls.set(this._pattern as ComboboxListboxPattern<V>);
160160
}
161161

162-
afterRenderEffect(() => {
163-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
162+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
163+
afterRenderEffect(() => {
164164
const violations = this._pattern.validate();
165165
for (const violation of violations) {
166166
console.error(violation);
167167
}
168-
}
169-
});
168+
});
169+
}
170170

171171
afterRenderEffect(() => {
172172
if (!this._hasFocused()) {

src/aria/toolbar/toolbar.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ export class Toolbar<V> {
109109
private _hasBeenFocused = signal(false);
110110

111111
constructor() {
112-
afterRenderEffect(() => {
113-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
112+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
113+
afterRenderEffect(() => {
114114
const violations = this._pattern.validate();
115115
for (const violation of violations) {
116116
console.error(violation);
117117
}
118-
}
119-
});
118+
});
119+
}
120120

121121
afterRenderEffect(() => {
122122
if (!this._hasBeenFocused()) {

0 commit comments

Comments
 (0)