Skip to content

fix: support mounting multiple instances of the same parcel config#573

Merged
arturovt merged 1 commit intomasterfrom
fix/234
Apr 16, 2026
Merged

fix: support mounting multiple instances of the same parcel config#573
arturovt merged 1 commit intomasterfrom
fix/234

Conversation

@arturovt
Copy link
Copy Markdown
Member

Previously, the options object returned by singleSpaAngular() stored lifecycle state (bootstrappedRef, bootstrappedNgZone, routingEventListener) as flat singleton properties. When the same parcel config was passed to mountRootParcel() more than once, all instances shared this state, causing only one parcel to function correctly.

Fixes this by introducing a per-instance instances map on the options object, keyed by props.name || props.appName. Each call to bootstrap, mount, and unmount now reads and writes its own BootstrappedInstanceRef entry, so multiple parcels using the same config are fully independent.

This mirrors the fix applied to single-spa-react in single-spa/single-spa-react#68 and follows the pattern originally suggested in the issue.

Closes #234

Previously, the options object returned by `singleSpaAngular()` stored
lifecycle state (`bootstrappedRef`, `bootstrappedNgZone`,
`routingEventListener`) as flat singleton properties. When the same
parcel config was passed to `mountRootParcel()` more than once, all
instances shared this state, causing only one parcel to function
correctly.

Fixes this by introducing a per-instance `instances` map on the options
object, keyed by `props.name || props.appName`. Each call to
`bootstrap`, `mount`, and `unmount` now reads and writes its own
`BootstrappedInstanceRef` entry, so multiple parcels using the same
config are fully independent.

This mirrors the fix applied to single-spa-react in
single-spa/single-spa-react#68 and follows the pattern originally
suggested in the issue.

Closes #234
@arturovt arturovt merged commit b713ce6 into master Apr 16, 2026
1 check passed
@arturovt arturovt deleted the fix/234 branch April 16, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems with mounting the same parcelConfig multiple times

1 participant