Skip to content

Commit

Permalink
fix: only create single-spa-container element when not using replaceM…
Browse files Browse the repository at this point in the history
…ode (#109)

* fix: only create single-spa-container element when not using replaceMode

* style: format code with prettier
  • Loading branch information
FelixGraf committed Jun 29, 2023
1 parent e481396 commit 6844714
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/single-spa-vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ function mount(opts, mountedInstances, props) {

if (!opts.replaceMode) {
appOptions.el = appOptions.el + " .single-spa-container";
}

// single-spa-vue@>=2 always REPLACES the `el` instead of appending to it.
// We want domEl to stick around and not be replaced. So we tell Vue to mount
// into a container div inside of the main domEl
if (!domEl.querySelector(".single-spa-container")) {
const singleSpaContainer = document.createElement("div");
singleSpaContainer.className = "single-spa-container";
domEl.appendChild(singleSpaContainer);
// single-spa-vue@>=2 always REPLACES the `el` instead of appending to it.
// We want domEl to stick around and not be replaced. So we tell Vue to mount
// into a container div inside of the main domEl
if (!domEl.querySelector(".single-spa-container")) {
const singleSpaContainer = document.createElement("div");
singleSpaContainer.className = "single-spa-container";
domEl.appendChild(singleSpaContainer);
}
}

instance.domEl = domEl;
Expand Down

0 comments on commit 6844714

Please sign in to comment.