Code comments are confusing on correct way to setup zoneless.

Open Beginner friendly
#577 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
angular, typescript

Research direction

Start by locating the provideSingleSpaPlatform() documentation and the mount method comment referenced in the issue. Compare their guidance for zoned and zoneless setups, then update the comments and example so the required configuration is unambiguous. Verify that the documented setup matches the behavior of single-spa-angular 21.0.2 with Angular 22.1.0.

Written by the indexing model from the issue text.

Description

Question

The comment on the provideSingleSpaPlatform() method is

/**
 * The `PlatformLocation` class is injected into `PathLocationStrategy`,
 * which creates a `Subject` internally for listening to `popstate` events. We provide
 * this custom class in the root injector used during application bootstrapping.
 *
 * THIS IS REQUIRED FOR ALL APPLICATIONS (BOTH ZONE AND ZONELESS). Pass the result of
 * this function to `platformBrowser()` when bootstrapping your application:
 *
 * @example
 * const lifecycles = singleSpaAngular({
 *   bootstrapFunction: async () => {
 *     const platformRef = platformBrowser(provideSingleSpaPlatform());
 *     return bootstrapApplication(AppComponent, appConfig, { platformRef });
 *   },
 *   template: '<app-root />',
 *   NgZone: 'noop',
 *   Router,
 *   NavigationStart,
 * });
 */

But in the mount method there's this comment.

  // However, if the app is running in zoneless mode (`NgZone: 'noop'`), change detection is
  // managed manually and the platform location override is not needed, so we skip this check.

This means I should be able to get away with this setup right?

const lifecycles = singleSpaAngular({
  bootstrapFunction: (singleSpaProps: SingleSpaProps) => {
    singleSpaPropsSubject.next(singleSpaProps);
    return bootstrapApplication(AppComponent, appConfig);
  },
  template: '<my-mfe-root />',
  NavigationStart,
  NgZone: 'noop',
});
Environment

Libs:
- @angular/core version: 22.1.0
- single-spa-angular version: 21.0.2

Dominant language
TypeScript
Stars
209
Forks
77
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from single-spa/single-spa-angular

All issues in single-spa/single-spa-angular

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.