Skip to content

Commit bdb4bb8

Browse files
committed
fix: with platform-browser, provideZoneChangeDetection belongs in app.module.ts
With Angular 21, provideZoneChangeDetection is required, otherwise our microphone buttons don't work properly, but with the deprecated platform-browser-dynamic, that belonged in main.ts, while with the recommended platform-browser, it has to be moved to the NgModule's provides in app.module.ts.
1 parent 1c70e2a commit bdb4bb8

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/studio-web/src/app/app.module.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { ToastrModule } from "ngx-toastr";
22

33
import { provideHttpClient } from "@angular/common/http";
4-
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from "@angular/core";
4+
import {
5+
CUSTOM_ELEMENTS_SCHEMA,
6+
NgModule,
7+
provideZoneChangeDetection,
8+
} from "@angular/core";
59
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
610
import { BrowserModule } from "@angular/platform-browser";
711
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
@@ -53,7 +57,7 @@ defineCustomElements();
5357
NgxRAWebComponentModule,
5458
SharedModule,
5559
],
56-
providers: [provideHttpClient()],
60+
providers: [provideHttpClient(), provideZoneChangeDetection()],
5761
bootstrap: [AppComponent],
5862
schemas: [CUSTOM_ELEMENTS_SCHEMA],
5963
})

packages/studio-web/src/main.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { enableProdMode, provideZoneChangeDetection } from "@angular/core";
21
import { platformBrowser } from "@angular/platform-browser";
2+
import { enableProdMode } from "@angular/core";
33

44
import { AppModule } from "./app/app.module";
55
import { environment } from "./environments/environment";
@@ -9,7 +9,5 @@ if (environment.production) {
99
}
1010

1111
platformBrowser()
12-
.bootstrapModule(AppModule, {
13-
applicationProviders: [provideZoneChangeDetection()],
14-
})
12+
.bootstrapModule(AppModule)
1513
.catch((err: any) => console.error(err));

0 commit comments

Comments
 (0)