-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Remove zone.js #165
Comments
Here is the official documentation about zoneless requirements. One way would be to use ChangeDetectionStrategy.OnPush for the components. If thats not possible:
Using signals also means input signals instead of the decorator based version. |
I think that moving to onPush would make this library more performant, but it is also not an easy change, especially since users can add components inside the provided component. |
Is it what you had in mind? It's just the beginning https://github.com/maplibre/ngx-maplibre-gl/pull/167/files |
I'm not familiar enough with signals, but sure, if this is how it's done. |
I think that is one way to make it compatible with zoneless. Just curious, why you choose |
yeah I think |
I'm in the process of replacing Let me know if it is useful and if it goes in the right direction. @marcjulian @HarelM |
I think the direction is good, but I think the main concern regarding zone is how the map events are handled when zonejs is not present. |
I updated the repo to Angular 18 and enabled experimental zoneless in this PR (#172). Looks like the map is not rendered in a zoneless application, while already using |
Changes required: // app.config.ts
export const appConfig: ApplicationConfig = {
providers: [
- provideZoneChangeDetection({ eventCoalescing: true }),
+ provideExperimentalZonelessChangeDetection(),
provideRouter(routes),
provideHttpClient(withFetch()),
provideAnimations(),
provideClientHydration(),
],
}; Remove Remove NgZone.onMicrotaskEmpty, NgZone.onUnstable, NgZone.isStable, or NgZone.onStable (https://angular.dev/guide/experimental/zoneless#remove-ngzoneonmicrotaskempty-ngzoneonunstable-ngzoneisstable-or-ngzoneonstable) (#183) |
* revert removing zone.onMicrotaskEmpty to cleanup cluster correctly on zoom, closes #188 * need to figure out, how to replace for #165 * unsubscribe from zone.onMicrotaskEmpty * zone.onMicrotaskEmpty subscription already unsubscribed because of subscription list * remove unused import * replace zone.onMicrotaskEmpty with afterRender to call applyChanges * rename applyChanges to clearMapElements
I'm not sure if this is possible, and if it's possible, it's probably a huge effort, but it seems that the Angular team is making new features available for zoneless apps.
If I understand the direction correctly, they are aiming to remove zonejs as much as possible.
I think it might be a good idea to try and move this library to that direction and avoid using zonejs.
Any thoughts on this are welcome.
This is more of a hunch at this point in time.
Here's an article that talks about it a bit and it looks like more support for this might come only in version 18:
https://netbasal.com/navigating-the-new-era-of-angular-zoneless-change-detection-unveiled-e7404de69b89
So it might be a bit premature ATM. IDK...
The text was updated successfully, but these errors were encountered: