Skip to content

Commit

Permalink
make current iframe inactive when switch to wc (SAP#1991)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardl authored Apr 20, 2021
1 parent 91bf5fa commit b5daa03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions core/src/App.html
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@
* to prevent half-initialized clients
*/
if ('luigi.init.ok' === e.data.msg) {
config.iframe.luigi.initOk = true;
iframe.luigi.initOk = true;
}

if ('luigi.navigate.ok' === e.data.msg) {
Expand All @@ -1117,8 +1117,8 @@
}

if ('luigi.get-context' === e.data.msg) {
config.iframe.luigi.clientVersion = e.data.clientVersion; // undefined for v0.x clients
config.iframe.luigi.initOk = false; // get-context indication. used for handshake verification
iframe.luigi.clientVersion = e.data.clientVersion; // undefined for v0.x clients
iframe.luigi.initOk = false; // get-context indication. used for handshake verification

const specialIframeProps = {
modalIframe,
Expand Down
18 changes: 10 additions & 8 deletions core/src/services/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RoutingClass {
}
const hashRouting = LuigiConfig.getConfigValue('routing.useHashRouting');
let url = new URL(location.href);
hashRouting ? url.hash = route : url.pathname = route;
hashRouting ? (url.hash = route) : (url.pathname = route);

const chosenHistoryMethod = pushState ? 'pushState' : 'replaceState';
const method = LuigiConfig.getConfigValue('routing.disableBrowserHistory') ? 'replaceState' : chosenHistoryMethod;
Expand Down Expand Up @@ -143,8 +143,8 @@ class RoutingClass {
return LuigiConfig.getConfigValue('routing.useHashRouting')
? window.location.hash.replace('#', '') // TODO: GenericHelpers.getPathWithoutHash(window.location.hash) fails in ContextSwitcher
: window.location.search
? GenericHelpers.trimLeadingSlash(window.location.pathname) + window.location.search
: GenericHelpers.trimLeadingSlash(window.location.pathname);
? GenericHelpers.trimLeadingSlash(window.location.pathname) + window.location.search
: GenericHelpers.trimLeadingSlash(window.location.pathname);
}

async handleRouteChange(path, component, iframeElement, config, withoutSync) {
Expand All @@ -170,7 +170,7 @@ class RoutingClass {
this.handleRouteChange(path, component, iframeElement, config) &&
history.replaceState(window.state, '', newUrl);
},
() => { }
() => {}
);
return;
}
Expand Down Expand Up @@ -288,10 +288,10 @@ class RoutingClass {
Object.assign({}, newNodeData, {
previousNodeValues: previousCompData
? {
viewUrl: previousCompData.viewUrl,
isolateView: previousCompData.isolateView,
viewGroup: previousCompData.viewGroup
}
viewUrl: previousCompData.viewUrl,
isolateView: previousCompData.isolateView,
viewGroup: previousCompData.viewGroup
}
: {}
})
);
Expand Down Expand Up @@ -319,11 +319,13 @@ class RoutingClass {
if (iContainer) {
iContainer.classList.add('lui-webComponent');
}
Iframe.switchActiveIframe(iframeElement, undefined, false);
this.navigateWebComponentCompound(config, component, iframeElement, nodeObject, iContainer);
} else if (nodeObject.webcomponent && GenericHelpers.requestExperimentalFeature('webcomponents', true)) {
if (iContainer) {
iContainer.classList.add('lui-webComponent');
}
Iframe.switchActiveIframe(iframeElement, undefined, false);
this.navigateWebComponent(config, component, iframeElement, nodeObject, iContainer);
} else {
if (iContainer) {
Expand Down

0 comments on commit b5daa03

Please sign in to comment.