Skip to content
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

make current iframe inactive when switch to wc #1991

Merged
merged 2 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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